[qfprogs] Dump hex for non-ascii chars

More useful when dealing with non-quake text (especially broken utf-8
strings).
This commit is contained in:
Bill Currie 2022-12-10 21:53:00 +09:00
parent 6a9985c8aa
commit 6fc2dcae20
1 changed files with 7 additions and 2 deletions

View File

@ -46,7 +46,7 @@ dump_string_block (const char *strblock, size_t size)
printf ("%x \"", 0);
while ((size_t) (s - strblock) < size) {
char c = *s++;
byte c = *s++;
switch (c) {
case 0:
fputs ("\"\n", stdout);
@ -69,7 +69,12 @@ dump_string_block (const char *strblock, size_t size)
fputs ("\\\\", stdout);
break;
default:
fputc (sys_char_map[(unsigned char)c], stdout);
if (c < 32 || c > 126) {
printf ("\\x%02x", c);
} else {
fputc (c, stdout);
}
//fputc (sys_char_map[c], stdout);
break;
}
}