fix: print in hex format for non-ascii unicode

This commit is contained in:
Renge 2022-02-18 23:17:31 -05:00
parent cdaae370de
commit 799994c0b3

View File

@ -903,9 +903,19 @@ int argo_write_string(ARGO_STRING *s, FILE *f)
} }
} }
else else
{
if (c <= 0xff)
{ {
fprintf(f, "%c", *c); fprintf(f, "%c", *c);
} }
else if (c <= 0xfff)
{
fprintf(f, "\\u0%x", c);
}
else {
fprintf(f, "\\u%x", c);
}
}
break; break;
} }
} }