Skip to content

Commit 24bc09b

Browse files
committed
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.
1 parent 37c17d5 commit 24bc09b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/output.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function OutputStream(options) {
8686

8787
function make_string(str) {
8888
var dq = 0, sq = 0;
89-
str = str.replace(/[\\\b\f\n\r\t\x22\x27\u2028\u2029\0]/g, function(s){
89+
str = str.replace(/[\\\b\f\n\r\t\x22\x27\u2028\u2029\0\ufeff]/g, function(s){
9090
switch (s) {
9191
case "\\": return "\\\\";
9292
case "\b": return "\\b";
@@ -98,6 +98,7 @@ function OutputStream(options) {
9898
case '"': ++dq; return '"';
9999
case "'": ++sq; return "'";
100100
case "\0": return "\\x00";
101+
case "\ufeff": return "\\ufeff";
101102
}
102103
return s;
103104
});

0 commit comments

Comments
 (0)