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; } }