Escape undefined unicode characters in string literal

This commit is contained in:
Alexey Andreev 2017-04-22 00:38:04 +03:00
parent b409355000
commit 8e67fe0168
2 changed files with 3 additions and 1 deletions

View File

@ -67,7 +67,8 @@ public final class RenderingUtil {
if (c < ' ') {
sb.append("\\u00").append(Character.forDigit(c / 16, 16))
.append(Character.forDigit(c % 16, 16));
} else if (Character.isLowSurrogate(c) || Character.isHighSurrogate(c)) {
} else if (Character.isLowSurrogate(c) || Character.isHighSurrogate(c)
|| !Character.isDefined(c)) {
sb.append("\\u")
.append(Character.forDigit(c / 0x1000, 0x10))
.append(Character.forDigit((c / 0x100) % 0x10, 0x10))

View File

@ -73,6 +73,7 @@ async function runAll() {
});
const endTime = new Date().getTime();
console.log();
for (let i = 0; i < stats.testsFailed.length; i++) {
const failedTest = stats.testsFailed[i];
console.log("(" + (i + 1) + ") " + failedTest.path +":");