-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.1.5
-
x86
-
windows_nt
Name: tb29552 Date: 10/06/98
/*
The code in String which converts to UTF-8
has two problems:
1. It does not handle the null
char ('\u0000') correctly.
The null char is mapped to the null byte,
according to the Unicode standard version 2.0.
The code here allocated two bytes for it.
2. Why it's not public? I need it and I have to
copy the code.
*/
/**
* Returns the length of this string's UTF encoded form.
*/
int utfLength() {
int limit = offset + count;
int utflen = 0;
for (int i = offset; i < limit; i++) {
int c = value[i];
if ((c >= 0x0001) && (c <= 0x007F)) {
utflen++;
} else if (c > 0x07FF) {
utflen += 3;
} else {
utflen += 2;
}
}
return utflen;
}
(Review ID: 28739)
======================================================================
- relates to
-
JDK-4027524 NewStringUTF doesn't check correctness its UTF8 string argument
- Closed