aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-10 23:50:30 +0100
committerEugene Sandulenko2019-12-11 00:45:12 +0100
commitc85e5a64d72e763954cec0edd389a5acdfe44cd1 (patch)
treec68801bf599f59207d77c87c7871f71be5e33a87 /common
parent3c37e63780a58b42c9473224306f89be17f2196f (diff)
downloadscummvm-rg350-c85e5a64d72e763954cec0edd389a5acdfe44cd1.tar.gz
scummvm-rg350-c85e5a64d72e763954cec0edd389a5acdfe44cd1.tar.bz2
scummvm-rg350-c85e5a64d72e763954cec0edd389a5acdfe44cd1.zip
COMMON: Fix toPrintable() for upper characters
Diffstat (limited to 'common')
-rw-r--r--common/str.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/common/str.cpp b/common/str.cpp
index 95b13be2aa..0082dc1bec 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -1103,7 +1103,7 @@ String toPrintable(const String &in, bool keepNewLines) {
"\x10\x11\x12\x13\x14\x15\x16\x17"
"\x18\x19\x1a" "e\x1c\x1d\x1e\x1f";
- for (const char *p = in.c_str(); *p; p++) {
+ for (const byte *p = (const byte *)in.c_str(); *p; p++) {
if (*p == '\n') {
if (keepNewLines)
res += *p;
@@ -1124,6 +1124,8 @@ String toPrintable(const String &in, bool keepNewLines) {
} else {
res += *p; // We will escape it
}
+ } else if (*p > 0x7e) {
+ res += Common::String::format("\\x%02x", *p);
} else
res += *p;
}