From: Steinar H. Gunderson Date: Fri, 29 Oct 2021 22:42:16 +0000 (+0200) Subject: Fix an issue where non-ASCII characters would be wrongly escaped. X-Git-Tag: 1.1.13~1 X-Git-Url: https://git.sesse.net/?p=plocate;a=commitdiff_plain;h=715897115c997a851a2f1c2aa56b580b3ca4aa28 Fix an issue where non-ASCII characters would be wrongly escaped. This only happens on platforms with signed char. Reported by COLIN Stéphane. --- 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;