mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fixes some UTF-16 relates issues
This commit is contained in:
parent
2178ac34e5
commit
3a9be43894
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user