--- a/tests.js Fri Jul 22 11:41:21 2011 -0600
+++ b/tests.js Fri Jul 22 11:42:50 2011 -0600
@@ -3386,6 +3386,9 @@
return String(value);
}
+ value = value.replace(/\\/g, "\\\\")
+ .replace(/"/g, '\\"');
+
for (var i = 0; i < 32; i++) {
var replace = "\\";
switch (i) {
@@ -3422,9 +3425,9 @@
case 30: replace += "x1e"; break;
case 31: replace += "x1f"; break;
}
- value = value.replace(String.fromCharCode(i), replace);
+ value = value.replace(new RegExp(String.fromCharCode(i), "g"), replace);
}
- return '"' + value.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"';
+ return '"' + value + '"';
}
//@}