Small fixes to Unicode handling:

- Add more mappings for Greek characters and the Euro sign.
- Print UTF-8 characters in the log file as hexadecimal.
This commit is contained in:
ed 2009-06-16 14:55:13 +00:00
parent 2afe948156
commit c971ea42f7
2 changed files with 43 additions and 38 deletions

View File

@ -343,48 +343,53 @@ struct unicp437 {
};
static const struct unicp437 cp437table[] = {
{ 0x0020, 0x20, 0x5e }, { 0x00a1, 0xad, 0x00 },
{ 0x00a2, 0x9b, 0x00 }, { 0x00a3, 0x9c, 0x00 },
{ 0x00a5, 0x9d, 0x00 }, { 0x00a7, 0x15, 0x00 },
{ 0x00aa, 0xa6, 0x00 }, { 0x00ab, 0xae, 0x00 },
{ 0x00ac, 0xaa, 0x00 }, { 0x00b0, 0xf8, 0x00 },
{ 0x00b1, 0xf1, 0x00 }, { 0x00b2, 0xfd, 0x00 },
{ 0x00b5, 0xe6, 0x00 }, { 0x00b6, 0x14, 0x00 },
{ 0x00b7, 0xfa, 0x00 }, { 0x00ba, 0xa7, 0x00 },
{ 0x00bb, 0xaf, 0x00 }, { 0x00bc, 0xac, 0x00 },
{ 0x00bd, 0xab, 0x00 }, { 0x00bf, 0xa8, 0x00 },
{ 0x00c4, 0x8e, 0x01 }, { 0x00c6, 0x92, 0x00 },
{ 0x00c7, 0x80, 0x00 }, { 0x00c9, 0x90, 0x00 },
{ 0x00d1, 0xa5, 0x00 }, { 0x00d6, 0x99, 0x00 },
{ 0x00dc, 0x9a, 0x00 }, { 0x00df, 0xe1, 0x00 },
{ 0x00e0, 0x85, 0x00 }, { 0x00e1, 0xa0, 0x00 },
{ 0x00e2, 0x83, 0x00 }, { 0x00e4, 0x84, 0x00 },
{ 0x00e5, 0x86, 0x00 }, { 0x00e6, 0x91, 0x00 },
{ 0x00e7, 0x87, 0x00 }, { 0x00e8, 0x8a, 0x00 },
{ 0x00e9, 0x82, 0x00 }, { 0x00ea, 0x88, 0x01 },
{ 0x00ec, 0x8d, 0x00 }, { 0x00ed, 0xa1, 0x00 },
{ 0x00ee, 0x8c, 0x00 }, { 0x00ef, 0x8b, 0x00 },
{ 0x0020, 0x20, 0x5e }, { 0x00a0, 0x20, 0x00 },
{ 0x00a1, 0xad, 0x00 }, { 0x00a2, 0x9b, 0x00 },
{ 0x00a3, 0x9c, 0x00 }, { 0x00a5, 0x9d, 0x00 },
{ 0x00a7, 0x15, 0x00 }, { 0x00aa, 0xa6, 0x00 },
{ 0x00ab, 0xae, 0x00 }, { 0x00ac, 0xaa, 0x00 },
{ 0x00b0, 0xf8, 0x00 }, { 0x00b1, 0xf1, 0x00 },
{ 0x00b2, 0xfd, 0x00 }, { 0x00b5, 0xe6, 0x00 },
{ 0x00b6, 0x14, 0x00 }, { 0x00b7, 0xfa, 0x00 },
{ 0x00ba, 0xa7, 0x00 }, { 0x00bb, 0xaf, 0x00 },
{ 0x00bc, 0xac, 0x00 }, { 0x00bd, 0xab, 0x00 },
{ 0x00bf, 0xa8, 0x00 }, { 0x00c4, 0x8e, 0x01 },
{ 0x00c6, 0x92, 0x00 }, { 0x00c7, 0x80, 0x00 },
{ 0x00c9, 0x90, 0x00 }, { 0x00d1, 0xa5, 0x00 },
{ 0x00d6, 0x99, 0x00 }, { 0x00dc, 0x9a, 0x00 },
{ 0x00df, 0xe1, 0x00 }, { 0x00e0, 0x85, 0x00 },
{ 0x00e1, 0xa0, 0x00 }, { 0x00e2, 0x83, 0x00 },
{ 0x00e4, 0x84, 0x00 }, { 0x00e5, 0x86, 0x00 },
{ 0x00e6, 0x91, 0x00 }, { 0x00e7, 0x87, 0x00 },
{ 0x00e8, 0x8a, 0x00 }, { 0x00e9, 0x82, 0x00 },
{ 0x00ea, 0x88, 0x01 }, { 0x00ec, 0x8d, 0x00 },
{ 0x00ed, 0xa1, 0x00 }, { 0x00ee, 0x8c, 0x00 },
{ 0x00ef, 0x8b, 0x00 }, { 0x00f0, 0xeb, 0x00 },
{ 0x00f1, 0xa4, 0x00 }, { 0x00f2, 0x95, 0x00 },
{ 0x00f3, 0xa2, 0x00 }, { 0x00f4, 0x93, 0x00 },
{ 0x00f6, 0x94, 0x00 }, { 0x00f7, 0xf6, 0x00 },
{ 0x00f9, 0x97, 0x00 }, { 0x00fa, 0xa3, 0x00 },
{ 0x00fb, 0x96, 0x00 }, { 0x00fc, 0x81, 0x00 },
{ 0x00ff, 0x98, 0x00 }, { 0x0192, 0x9f, 0x00 },
{ 0x0393, 0xe2, 0x00 }, { 0x0398, 0xe9, 0x00 },
{ 0x03a3, 0xe4, 0x00 }, { 0x03a6, 0xe8, 0x00 },
{ 0x03a9, 0xea, 0x00 }, { 0x03b1, 0xe0, 0x00 },
{ 0x03b4, 0xeb, 0x00 }, { 0x03b5, 0xee, 0x00 },
{ 0x00f8, 0xed, 0x00 }, { 0x00f9, 0x97, 0x00 },
{ 0x00fa, 0xa3, 0x00 }, { 0x00fb, 0x96, 0x00 },
{ 0x00fc, 0x81, 0x00 }, { 0x00ff, 0x98, 0x00 },
{ 0x0192, 0x9f, 0x00 }, { 0x0393, 0xe2, 0x00 },
{ 0x0398, 0xe9, 0x00 }, { 0x03a3, 0xe4, 0x00 },
{ 0x03a6, 0xe8, 0x00 }, { 0x03a9, 0xea, 0x00 },
{ 0x03b1, 0xe0, 0x01 }, { 0x03b4, 0xeb, 0x00 },
{ 0x03b5, 0xee, 0x00 }, { 0x03bc, 0xe6, 0x00 },
{ 0x03c0, 0xe3, 0x00 }, { 0x03c3, 0xe5, 0x00 },
{ 0x03c4, 0xe7, 0x00 }, { 0x03c6, 0xed, 0x00 },
{ 0x2010, 0x2d, 0x00 }, { 0x2014, 0x2d, 0x00 },
{ 0x2018, 0x60, 0x00 }, { 0x2019, 0x27, 0x00 },
{ 0x201c, 0x22, 0x00 }, { 0x201d, 0x22, 0x00 },
{ 0x2022, 0x07, 0x00 }, { 0x203c, 0x13, 0x00 },
{ 0x207f, 0xfc, 0x00 }, { 0x20a7, 0x9e, 0x00 },
{ 0x2190, 0x1b, 0x00 }, { 0x2191, 0x18, 0x00 },
{ 0x2192, 0x1a, 0x00 }, { 0x2193, 0x19, 0x00 },
{ 0x2194, 0x1d, 0x00 }, { 0x2195, 0x12, 0x00 },
{ 0x21a8, 0x17, 0x00 }, { 0x2212, 0x2d, 0x00 },
{ 0x03d5, 0xed, 0x00 }, { 0x2010, 0x2d, 0x00 },
{ 0x2014, 0x2d, 0x00 }, { 0x2018, 0x60, 0x00 },
{ 0x2019, 0x27, 0x00 }, { 0x201c, 0x22, 0x00 },
{ 0x201d, 0x22, 0x00 }, { 0x2022, 0x07, 0x00 },
{ 0x203c, 0x13, 0x00 }, { 0x207f, 0xfc, 0x00 },
{ 0x20a7, 0x9e, 0x00 }, { 0x20ac, 0xee, 0x00 },
{ 0x2126, 0xea, 0x00 }, { 0x2190, 0x1b, 0x00 },
{ 0x2191, 0x18, 0x00 }, { 0x2192, 0x1a, 0x00 },
{ 0x2193, 0x19, 0x00 }, { 0x2194, 0x1d, 0x00 },
{ 0x2195, 0x12, 0x00 }, { 0x21a8, 0x17, 0x00 },
{ 0x2202, 0xeb, 0x00 }, { 0x2208, 0xee, 0x00 },
{ 0x2211, 0xe4, 0x00 }, { 0x2212, 0x2d, 0x00 },
{ 0x2219, 0xf9, 0x00 }, { 0x221a, 0xfb, 0x00 },
{ 0x221e, 0xec, 0x00 }, { 0x221f, 0x1c, 0x00 },
{ 0x2229, 0xef, 0x00 }, { 0x2248, 0xf7, 0x00 },

View File

@ -300,7 +300,7 @@ teken_input_byte(teken_t *t, unsigned char c)
t->t_utf8_left--;
t->t_utf8_partial = (t->t_utf8_partial << 6) | (c & 0x3f);
if (t->t_utf8_left == 0) {
teken_printf("Got UTF-8 char %u\n", t->t_utf8_partial);
teken_printf("Got UTF-8 char %x\n", t->t_utf8_partial);
teken_input_char(t, t->t_utf8_partial);
}
}