From 297ca3d56eff8d477ca0466375e2df6e2c7f28c5 Mon Sep 17 00:00:00 2001 From: jyelon Date: Mon, 9 May 2022 15:10:09 -0400 Subject: [PATCH] Fix the pretty-printing of strings --- luprex/core/cpp/util.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/luprex/core/cpp/util.cpp b/luprex/core/cpp/util.cpp index ccb3df7a..dc872e79 100644 --- a/luprex/core/cpp/util.cpp +++ b/luprex/core/cpp/util.cpp @@ -313,12 +313,13 @@ void quote_string(const eng::string &s, std::ostream *os) { (*os) << c; } } else { + unsigned int value = ((unsigned char)c); switch (c) { case '\n': (*os) << "\\n"; break; case '\t': (*os) << "\\t"; break; case '\r': (*os) << "\\r"; break; default: - (*os) << "\\" << std::setfill('0') << std::setw(3) << int(c); + (*os) << "\\" << std::setfill('0') << std::setw(3) << value; break; } }