diff --git a/lib/output.js b/lib/output.js index a3c6b4ab..62dbf49b 100644 --- a/lib/output.js +++ b/lib/output.js @@ -134,7 +134,7 @@ function OutputStream(options) { function make_string(str, quote) { var dq = 0, sq = 0; - str = str.replace(/[\\\b\f\n\r\v\t\x22\x27\u2028\u2029\0\ufeff]/g, + str = str.replace(/[\\\b\f\n\r\v\t\x22\x27\u2028\u2029\0\ufeff\uffff]/g, function(s, i){ switch (s) { case '"': ++dq; return '"'; @@ -149,6 +149,7 @@ function OutputStream(options) { case "\u2028": return "\\u2028"; case "\u2029": return "\\u2029"; case "\ufeff": return "\\ufeff"; + case "\uffff": return "\\uffff"; case "\0": return /[0-7]/.test(str.charAt(i+1)) ? "\\x00" : "\\0"; } @@ -1282,6 +1283,7 @@ function OutputStream(options) { 0x0d , // \r 0x00 , // \0 0xfeff , // Unicode BOM + 0xffff , // Unicode noncharacter 0x2028 , // unicode "line separator" 0x2029 , // unicode "paragraph separator" ].indexOf(code) < 0;