Skip to content
Snippets Groups Projects

inspect-library: Don't print non-ASCII as nonsense codepoints

Merged Simon McVittie requested to merge wip/sr385-non-codepoints into master
1 file
+ 3
3
Compare changes
  • Side-by-side
  • Inline
+ 3
3
@@ -485,11 +485,11 @@ main (int argc,
@@ -485,11 +485,11 @@ main (int argc,
static void
static void
print_json_string_content (const char *s)
print_json_string_content (const char *s)
{
{
const char *p;
const unsigned char *p;
for (p = s; *p != '\0'; p++)
for (p = (const unsigned char *) s; *p != '\0'; p++)
{
{
if (*p == '"' || *p == '\\' || *p <= 0x1F)
if (*p == '"' || *p == '\\' || *p <= 0x1F || *p >= 0x80)
printf ("\\u%04x", *p);
printf ("\\u%04x", *p);
else
else
printf ("%c", *p);
printf ("%c", *p);
Loading