These ones were not properly encoded, causing confusion on the output.
while (ptr < err->len) {
c = err->buf[ptr];
- if (isprint(c)) {
+ if (isprint(c) && isascii(c) && c != '\\') {
if (out->len > end - 2)
break;
out->str[out->len++] = c;
- } else if (c == '\t' || c == '\n' || c == '\r' || c == '\e') {
+ } else if (c == '\t' || c == '\n' || c == '\r' || c == '\e' || c == '\\') {
if (out->len > end - 3)
break;
out->str[out->len++] = '\\';
case '\n': c = 'n'; break;
case '\r': c = 'r'; break;
case '\e': c = 'e'; break;
+ case '\\': c = '\\'; break;
}
out->str[out->len++] = c;
} else {