[Bug 182] New: GetStringUTFChars returns incorrect for U+4E00
[email protected] Thu, 14 Sep 2006 20:58:10 -0400
| Newsgroups | gmane.comp.java.vm.sablevm.bugs |
|---|---|
| Message-ID | <[email protected]> |
http://sablevm.org/bugs/show_bug.cgi?id=182
Summary: GetStringUTFChars returns incorrect for U+4E00
Product: SableVM
Version: 1.11[.x]
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: default
AssignedTo: [email protected]
ReportedBy: [email protected]
QAContact: [email protected]
The JNI method GetStringUTFChars returns incorrect utf-8 for character U+4E00
(atleast).
It returns:
"\344\250\200"
It should return:
"\344\270\200"
I think the fix is something like:
--- ./vm/reference/java/lang/StringCreator.java.orig 2006-09-15
12:32:29.000000000 +1200
+++ ./vm/reference/java/lang/StringCreator.java 2006-09-15 12:32:46.000000000
+1200
@@ -141,13 +141,13 @@ class StringCreator
else if (c >= 0x0800)
{
result[current++] = (byte) (0xE0 | ((c >> 12) & 0x0F));
- result[current++] = (byte) (0x80 | ((c >> 6) & 0x2F));
- result[current++] = (byte) (0x80 | (c & 0x2F));
+ result[current++] = (byte) (0x80 | ((c >> 6) & 0x3F));
+ result[current++] = (byte) (0x80 | (c & 0x3F));
}
else
{
result[current++] = (byte) (0xC0 | ((c >> 6) & 0x1F));
- result[current++] = (byte) (0x80 | (c & 0x2F));
+ result[current++] = (byte) (0x80 | (c & 0x3F));
}
}
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
You are the QA contact for the bug, or are watching the QA contact.