]> git.sesse.net Git - plocate/commitdiff
Fix an issue where non-ASCII characters would be wrongly escaped.
authorSteinar H. Gunderson <steinar+git@gunderson.no>
Fri, 29 Oct 2021 22:42:16 +0000 (00:42 +0200)
committerSteinar H. Gunderson <steinar+git@gunderson.no>
Fri, 29 Oct 2021 22:43:17 +0000 (00:43 +0200)
This only happens on platforms with signed char. Reported by
COLIN Stéphane.

serializer.cpp

index 7f3e88842da24ab9bf5d84360a8284bc1cf2061f..356094fde659f86715a730d76cf5801135782af0 100644 (file)
@@ -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;