mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +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);
|
printf ("%x \"", 0);
|
||||||
while ((size_t) (s - strblock) < size) {
|
while ((size_t) (s - strblock) < size) {
|
||||||
char c = *s++;
|
byte c = *s++;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 0:
|
case 0:
|
||||||
fputs ("\"\n", stdout);
|
fputs ("\"\n", stdout);
|
||||||
|
@ -69,7 +69,12 @@ dump_string_block (const char *strblock, size_t size)
|
||||||
fputs ("\\\\", stdout);
|
fputs ("\\\\", stdout);
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue