Compare commits

...
1 Commits
Author SHA1 Message Date
Burer 7d899ca2f3 libs/iconv: map dashes when converting to CP866
Test PR / Build (en_US) (pull_request) Successful in 1m47s
Test PR / Build (ru_RU) (pull_request) Successful in 1m53s
Test PR / Build (es_ES) (pull_request) Successful in 1m57s
CP866 has no dash, so en and em dashes were dropped and the text kept the
spaces that had surrounded them. Map the hyphens to ASCII 0x2D and the
longer dashes to 0x12, which the 8x16 system font draws as a full-width
dash.
2026-09-26 16:12:48 +03:00
+5
View File
@@ -72,6 +72,9 @@ static const unsigned char cp866_page04[96] = {
0x00, 0xf1, 0x00, 0x00, 0xf3, 0x00, /*0x00*/ 0x69, 0xf5, /* 0x50-0x57 */ // Fix BE and UK 'i'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, /* 0x58-0x5f */
};
static const unsigned char cp866_page20[6] = {
0x2d, 0x2d, 0x12, 0x12, 0x12, 0x12, /* 0x10-0x15 */ // 0x12 draws as a dash
};
static const unsigned char cp866_page22[8] = {
0x00, 0xf9, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
};
@@ -111,6 +114,8 @@ cp866_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
c = cp866_page00[wc-0x00a0];
else if (wc >= 0x0400 && wc < 0x0460)
c = cp866_page04[wc-0x0400];
else if (wc >= 0x2010 && wc < 0x2016)
c = cp866_page20[wc-0x2010];
else if (wc == 0x2116)
c = 0xfc;
else if (wc >= 0x2218 && wc < 0x2220)