Don't escape \t, \r or \n in terminal output

This commit is contained in:
Gina Häußge 2017-05-22 14:06:12 +02:00
parent 8942d7d50d
commit 5e55d637af

View file

@ -1054,8 +1054,9 @@ var getQueryParameterByName = function(name, url) {
*
* E.g. turns a null byte in the string into "\x00".
*
* Only characters 0 to 31, 127 and 255 will be escaped, that
* should leave printable characters and unicode alone.
* Characters 0 to 31 excluding 9, 10 and 13 will be escaped, as will
* 127 and 255. That should leave printable characters and unicode
* alone.
*
* Originally based on
* https://gist.github.com/mathiasbynens/1243213#gistcomment-53590
@ -1069,7 +1070,7 @@ var escapeUnprintableCharacters = function(str) {
var charCode;
while (!isNaN(charCode = str.charCodeAt(index))) {
if (charCode < 32 || charCode == 127 || charCode == 255) {
if ((charCode < 32 && charCode != 9 && charCode != 10 && charCode != 13) || charCode == 127 || charCode == 255) {
// special hex chars
result += "\\x" + (charCode > 15 ? "" : "0") + charCode.toString(16)
} else {