fix Unicode handling in parser (#1884)

There was an implicit assumption that first character within surrogate header range implies the next character must form a surrogate pair, which is not necessarily true.
This commit is contained in:
Alex Lam S.L
2017-05-09 01:58:31 +08:00
committed by GitHub
parent 3fac29a017
commit 2433bb4e52
4 changed files with 23 additions and 17 deletions

View File

@@ -135,4 +135,11 @@ describe("Unicode", function() {
}).code, tests[i][1]);
}
});
it("Should parse raw characters correctly", function() {
var ast = uglify.parse('console.log("\\udbff");');
assert.strictEqual(ast.print_to_string(), 'console.log("\udbff");');
ast = uglify.parse(ast.print_to_string());
assert.strictEqual(ast.print_to_string(), 'console.log("\udbff");');
});
});