Fixes some UTF-16 relates issues

This commit is contained in:
konsoletyper 2014-03-13 11:11:27 +04:00
parent 2178ac34e5
commit 3a9be43894
2 changed files with 1 additions and 1 deletions

View File

@ -30,6 +30,7 @@ public class UTF16Helper {
public static final int SUPPLEMENTARY_PLANE = 0x10000;
public static char highSurrogate(int codePoint) {
codePoint -= SUPPLEMENTARY_PLANE;
return (char)(HIGH_SURROGATE_BITS | (codePoint >> MEANINGFUL_SURROGATE_BITS) & SURROGATE_BIT_INV_MASK);
}

View File

@ -552,7 +552,6 @@ class TAbstractStringBuilder extends TObject implements TSerializable, TCharSequ
return append((char)codePoint);
}
ensureCapacity(length + 2);
codePoint -= UTF16Helper.SUPPLEMENTARY_PLANE;
buffer[length++] = UTF16Helper.highSurrogate(codePoint);
buffer[length++] = UTF16Helper.lowSurrogate(codePoint);
return this;