From 8e67fe01687dd807af326987822b7b2f1d0f1d88 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Sat, 22 Apr 2017 00:38:04 +0300 Subject: [PATCH] Escape undefined unicode characters in string literal --- .../org/teavm/backend/javascript/rendering/RenderingUtil.java | 3 ++- tests/src/test/js/src/run-tests.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingUtil.java b/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingUtil.java index a73b2c79e..4a1d657a4 100644 --- a/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingUtil.java +++ b/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingUtil.java @@ -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)) diff --git a/tests/src/test/js/src/run-tests.js b/tests/src/test/js/src/run-tests.js index 997c67c47..89f8c4db6 100644 --- a/tests/src/test/js/src/run-tests.js +++ b/tests/src/test/js/src/run-tests.js @@ -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 +":");