mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 05:00:35 +00:00
[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:
parent
6a9985c8aa
commit
6fc2dcae20
1 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue