From 806a21459df1d4e72aa74c38ea920f2d461eede3 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sat, 7 Sep 2024 17:23:18 -0700 Subject: [PATCH] fix utf8 escape --- src/Strings.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Strings.cc b/src/Strings.cc index 6978697..4ee68b7 100644 --- a/src/Strings.cc +++ b/src/Strings.cc @@ -118,7 +118,7 @@ string escape_controls(const string& s, bool escape_non_ascii) { ret += "\\a"; } else if (ch == '\v') { ret += "\\v"; - } else if (ch < 0x20 || (ch > 0x7E && escape_non_ascii)) { + } else if (escape_non_ascii ? (ch < 0x20 || ch > 0x7E) : ((ch < 0x20 && ch >= 0x00) || ch == 0x7F)) { ret += string_printf("\\x%02X", static_cast(ch)); } else { ret += ch;