Escape unprintable chars.

This commit is contained in:
Bill Currie 2012-07-19 12:29:00 +09:00
parent 1f9735d0cb
commit f680521e0f

View file

@ -388,7 +388,10 @@ quote_string (const char *str)
dstring_appendstr (q, """);
break;
default:
dstring_appendstr (q, c);
if (c[0] >= 127 || c[0] < 32)
dasprintf (q, "\\\\x%02d", (byte) c[0]);
else
dstring_appendstr (q, c);
break;
}
}