legacy: print inverted question mark for nonprintable characters

pull/1147/head
Andrew Kozlik 4 years ago committed by Pavol Rusnak
parent 89d701ed08
commit 38074a4e59
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
### Changed
- Print inverted question mark for non-printable characters.
### Deprecated

@ -93,4 +93,4 @@
/* 0x7c | */ (uint8_t *)"\x02\xff\xff",
/* 0x7d } */ (uint8_t *)"\x04\x82\xee\x7c\x10",
/* 0x7e ~ */ (uint8_t *)"\x04\x08\x10\x08\x10",
/* 0x7f _ */ (uint8_t *)"\x01\x00",
/* 0x7f _ */ (uint8_t *)"\x05\xff\xdf\xb5\xcf\xff",

@ -93,4 +93,4 @@
/* 0x7c | */ (uint8_t *)"\x03\x00\xfe\x00",
/* 0x7d } */ (uint8_t *)"\x04\x82\xee\x7c\x10",
/* 0x7e ~ */ (uint8_t *)"\x05\x18\x20\x10\x08\x30",
/* 0x7f _ */ (uint8_t *)"\x01\x00",
/* 0x7f _ */ (uint8_t *)"\x05\xff\xdf\xb5\xcf\xff",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -9,7 +9,7 @@ static inline char convert(char c) {
if (c < 0x80) {
return c;
} else if (c >= 0xC0) {
return '_';
return 0x7f;
} else {
return '\0';
}

@ -276,7 +276,7 @@ static uint8_t convert_char(const char a) {
// non-printable ASCII character
if (c < ' ') {
last_was_utf8 = 0;
return '_';
return 0x7f;
}
// regular ASCII character
@ -290,7 +290,7 @@ static uint8_t convert_char(const char a) {
// bytes 11xxxxxx are first bytes of UTF-8 characters
if (c >= 0xC0) {
last_was_utf8 = 1;
return '_';
return 0x7f;
}
if (last_was_utf8) {
@ -298,7 +298,7 @@ static uint8_t convert_char(const char a) {
return 0; // skip glyph
} else {
// ... or they are just non-printable ASCII characters
return '_';
return 0x7f;
}
return 0;

Loading…
Cancel
Save