From c85e5a64d72e763954cec0edd389a5acdfe44cd1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 10 Dec 2019 23:50:30 +0100 Subject: COMMON: Fix toPrintable() for upper characters --- common/str.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'common') 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; } -- cgit v1.2.3