From 715897115c997a851a2f1c2aa56b580b3ca4aa28 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 30 Oct 2021 00:42:16 +0200 Subject: [PATCH] Fix an issue where non-ASCII characters would be wrongly escaped. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This only happens on platforms with signed char. Reported by COLIN Stéphane. --- serializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serializer.cpp b/serializer.cpp index 7f3e888..356094f 100644 --- a/serializer.cpp +++ b/serializer.cpp @@ -91,7 +91,7 @@ void print_possibly_escaped(const string &str) } else if (ret == 0) { break; // EOF. } - if (*ptr < 32 || *ptr == '\'' || *ptr == '"' || *ptr == '\\') { + if ((unsigned char)*ptr < 32 || *ptr == '\'' || *ptr == '"' || *ptr == '\\') { if (!in_escaped_mode) { printf("'$'"); in_escaped_mode = true; -- 2.39.2