Add more characters that should not be un-escaped in regexps.
This commit is contained in:
parent
b4f8e7dc7b
commit
75e5f6edf9
|
|
@ -134,7 +134,7 @@ function OutputStream(options) {
|
||||||
|
|
||||||
function make_string(str, quote) {
|
function make_string(str, quote) {
|
||||||
var dq = 0, sq = 0;
|
var dq = 0, sq = 0;
|
||||||
str = str.replace(/[\\\b\f\n\r\v\t\x1f\x22\x27\u2028\u2029\0\ufeff\uffff]/g,
|
str = str.replace(/[\\\b\f\n\r\v\t\x1f\x22\x27\u2028\u2029\0\ufeff\ufffe\uffff]/g,
|
||||||
function(s, i){
|
function(s, i){
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case '"': ++dq; return '"';
|
case '"': ++dq; return '"';
|
||||||
|
|
@ -150,6 +150,7 @@ function OutputStream(options) {
|
||||||
case "\u2028": return "\\u2028";
|
case "\u2028": return "\\u2028";
|
||||||
case "\u2029": return "\\u2029";
|
case "\u2029": return "\\u2029";
|
||||||
case "\ufeff": return "\\ufeff";
|
case "\ufeff": return "\\ufeff";
|
||||||
|
case "\ufffe": return "\\ufffe";
|
||||||
case "\uffff": return "\\uffff";
|
case "\uffff": return "\\uffff";
|
||||||
case "\0":
|
case "\0":
|
||||||
return /[0-7]/.test(str.charAt(i+1)) ? "\\x00" : "\\0";
|
return /[0-7]/.test(str.charAt(i+1)) ? "\\x00" : "\\0";
|
||||||
|
|
@ -1285,6 +1286,7 @@ function OutputStream(options) {
|
||||||
0x00 , // \0
|
0x00 , // \0
|
||||||
0x1f ,
|
0x1f ,
|
||||||
0xfeff , // Unicode BOM
|
0xfeff , // Unicode BOM
|
||||||
|
0xfffe , // Unicode noncharacter
|
||||||
0xffff , // Unicode noncharacter
|
0xffff , // Unicode noncharacter
|
||||||
0x2028 , // unicode "line separator"
|
0x2028 , // unicode "line separator"
|
||||||
0x2029 , // unicode "paragraph separator"
|
0x2029 , // unicode "paragraph separator"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user