Replace surrogate chars with U+FFFD

Also add some more unicode input tests.
This commit is contained in:
Fredrik Fornwall
2016-01-19 23:11:20 +01:00
parent 38dd99e827
commit 54857d5fd4
2 changed files with 47 additions and 2 deletions

View File

@@ -218,7 +218,7 @@ public final class TerminalEmulator {
*/
private int mScrollCounter = 0;
private int mUtf8ToFollow, mUtf8Index;
private byte mUtf8ToFollow, mUtf8Index;
private final byte[] mUtf8InputBuffer = new byte[4];
public final TerminalColors mColors = new TerminalColors();
@@ -424,7 +424,11 @@ public final class TerminalEmulator {
processCodePoint(/* escape (hexadecimal=0x1B, octal=033): */27);
processCodePoint((codePoint & 0x7F) + 0x40);
} else {
if (Character.UNASSIGNED == Character.getType(codePoint)) codePoint = UNICODE_REPLACEMENT_CHAR;
switch (Character.getType(codePoint)) {
case Character.UNASSIGNED:
case Character.SURROGATE:
codePoint = UNICODE_REPLACEMENT_CHAR;
}
processCodePoint(codePoint);
}
}