Copy link to clipboard
Copied
I have this function for sanitizing text for JSON output that simplifies different line feed formats and escapes the quotation marks. So far it has worked fine, but now I noticed that when ESTK and Node.js provide different output when executed with a line change:
I.e. the string literal gets different treatment, but not sure if that's the Javascript parsing or .replace itself. Thoughts, Ideas?
sanitizeJsonText: function(str) {
return str.replace(/\r\n/g, "\\n")
.replace(/\r/g, "\\n")
.replace(/\n/g, "\\n")
.replace(/\'/g, "\\'")
.replace(/\"/g, "\\\"");
},
Never mind, PBCAK. Issue was duplicate escaping in one code branch that was not used in ESTK that was matched debug printing code duplicating behaviour
Copy link to clipboard
Copied
Never mind, PBCAK. Issue was duplicate escaping in one code branch that was not used in ESTK that was matched debug printing code duplicating behaviour