diff options
author | B. Watson <urchlay@slackware.uk> | 2024-12-20 16:32:14 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-12-20 16:32:14 -0500 |
commit | b757a7b42d6c54f431c31642cfbe0127e77cf822 (patch) | |
tree | d8a79dbb22e51ad1143959e04793e9bb016789b6 | |
parent | d74816a16b1594279aae19a11ca6581ac0a05dd5 (diff) | |
download | uxd-b757a7b42d6c54f431c31642cfbe0127e77cf822.tar.gz |
better printable forms of invalid unicode
-rw-r--r-- | uxd.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -84,6 +84,9 @@ extern int optind; /* replacement character � is U+FFFD */ #define PRINT_BAD "�" #define PRINT_BOM "B" +#define PRINT_OLONG "O" +#define PRINT_OORANGE "+" +#define PRINT_SURR "S" /* sprintf() formats for hex data */ #define LC_BYTE_FMT "%02x" @@ -643,25 +646,25 @@ char *classify_char(int *hl, unsigned char *bytes, int cont_count) { } else { *hl = HL_BAD; } - return PRINT_BAD; + return PRINT_OLONG; } if(is_surrogate(cont_count, bytes)) { if(wtf8_mode || permissive) { - *hl = HL_NORMAL; + *hl = HL_SPECIAL; } else { *hl = HL_BAD; } - return PRINT_BAD; + return PRINT_SURR; } if(is_out_of_range(cont_count, bytes)) { if(permissive) { - *hl = HL_NORMAL; + *hl = HL_SPECIAL; } else { *hl = HL_BAD; } - return PRINT_BAD; + return PRINT_OORANGE; } *hl = HL_NORMAL; |