Skip to content
Snippets Groups Projects
Commit 3035e097 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Broken vertical is 0xA6, not 0x86

Fix that, and also fix the cpstr_to_utf8() implementation that
bypasses the lookup function.
parent bd6b5f01
No related branches found
No related tags found
No related merge requests found
Pipeline #8361 passed
...@@ -1900,7 +1900,7 @@ cpoint_from_cptable(uint8_t ch, const struct codepage_def *cpdef) ...@@ -1900,7 +1900,7 @@ cpoint_from_cptable(uint8_t ch, const struct codepage_def *cpdef)
{ {
if (ch < 128) { if (ch < 128) {
if (ch == 0x7C && cpdef->broken_vertical) if (ch == 0x7C && cpdef->broken_vertical)
return 0x86; return 0xA6;
return ch; return ch;
} }
return cpdef->cp_unicode_table[ch - 128]; return cpdef->cp_unicode_table[ch - 128];
...@@ -2031,8 +2031,12 @@ cpstr_to_utf8(const char *cpstr, size_t buflen, size_t *outlen, const struct cod ...@@ -2031,8 +2031,12 @@ cpstr_to_utf8(const char *cpstr, size_t buflen, size_t *outlen, const struct cod
ch = cpstr[idx]; ch = cpstr[idx];
if (ch == 0) if (ch == 0)
cplen = 4; cplen = 4;
else if (ch < 128) else if (ch < 128) {
if (ch == 0x7C && cpdef->broken_vertical)
cplen = 2;
else
cplen = 1; cplen = 1;
}
else else
cplen = utf8_bytes(cpdef->cp_unicode_table[ch - 128]); cplen = utf8_bytes(cpdef->cp_unicode_table[ch - 128]);
if (cplen == -1) if (cplen == -1)
...@@ -2054,9 +2058,16 @@ cpstr_to_utf8(const char *cpstr, size_t buflen, size_t *outlen, const struct cod ...@@ -2054,9 +2058,16 @@ cpstr_to_utf8(const char *cpstr, size_t buflen, size_t *outlen, const struct cod
cplen = 0; cplen = 0;
} }
else if (ch < 128) { else if (ch < 128) {
if (ch == 0x7C && cpdef->broken_vertical) {
cplen = write_cp(rp, 0xA6);
if (cplen != 2)
goto error;
}
else {
*rp = ch; *rp = ch;
cplen = 1; cplen = 1;
} }
}
else { else {
cplen = write_cp(rp, cpdef->cp_unicode_table[ch - 128]); cplen = write_cp(rp, cpdef->cp_unicode_table[ch - 128]);
if (cplen < 1) if (cplen < 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment