Fix the pretty-printing of strings

This commit is contained in:
2022-05-09 15:10:09 -04:00
parent d6aa216505
commit 297ca3d56e

View File

@@ -313,12 +313,13 @@ void quote_string(const eng::string &s, std::ostream *os) {
(*os) << c; (*os) << c;
} }
} else { } else {
unsigned int value = ((unsigned char)c);
switch (c) { switch (c) {
case '\n': (*os) << "\\n"; break; case '\n': (*os) << "\\n"; break;
case '\t': (*os) << "\\t"; break; case '\t': (*os) << "\\t"; break;
case '\r': (*os) << "\\r"; break; case '\r': (*os) << "\\r"; break;
default: default:
(*os) << "\\" << std::setfill('0') << std::setw(3) << int(c); (*os) << "\\" << std::setfill('0') << std::setw(3) << value;
break; break;
} }
} }