diff options
author | Richard van Velzen <rvanvelzen1@gmail.com> | 2014-10-23 16:16:19 +0200 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2015-01-04 15:01:55 +0100 |
commit | 24bc09b79bf9ca3a09eef4f536e7637568f7097a (patch) | |
tree | 3f5c38bf25a69709f7f8c4ed3e1dfe5bebee34b9 | |
parent | 37c17d55410ced4283fe173110efb99f33885c54 (diff) | |
download | tracifyjs-24bc09b79bf9ca3a09eef4f536e7637568f7097a.tar.gz tracifyjs-24bc09b79bf9ca3a09eef4f536e7637568f7097a.zip |
Fix #556
`\uFEFF` (ZERO WIDTH NO-BREAK SPACE) is removed when parsing, but was
un-escaped for the output when `ascii_only` was false.
When using
UglifyJS multiple times (creating packages from minified sources, for
example), this would lead to problems because the byte was removed when
parsing for the second time.
-rw-r--r-- | lib/output.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/output.js b/lib/output.js index 7bca4dae..72bcdd5e 100644 --- a/lib/output.js +++ b/lib/output.js @@ -86,7 +86,7 @@ function OutputStream(options) { function make_string(str) { var dq = 0, sq = 0; - str = str.replace(/[\\\b\f\n\r\t\x22\x27\u2028\u2029\0]/g, function(s){ + str = str.replace(/[\\\b\f\n\r\t\x22\x27\u2028\u2029\0\ufeff]/g, function(s){ switch (s) { case "\\": return "\\\\"; case "\b": return "\\b"; @@ -98,6 +98,7 @@ function OutputStream(options) { case '"': ++dq; return '"'; case "'": ++sq; return "'"; case "\0": return "\\x00"; + case "\ufeff": return "\\ufeff"; } return s; }); |