ref: 4a7f42e378e27bf70c928b411ac859c870c23f24
dir: /437.c/
/* https://en.wikipedia.org/wiki/Code_page_437 */ #include "tagspriv.h" static const uint8_t rh[129*3] = { 0xce, 0x94, 0x00, 0xc3, 0x87, 0x00, 0xc3, 0xbc, 0x00, 0xc3, 0xa9, 0x00, 0xc3, 0xa2, 0x00, 0xc3, 0xa4, 0x00, 0xc3, 0xa0, 0x00, 0xc3, 0xa5, 0x00, 0xc3, 0xa7, 0x00, 0xc3, 0xaa, 0x00, 0xc3, 0xab, 0x00, 0xc3, 0xa8, 0x00, 0xc3, 0xaf, 0x00, 0xc3, 0xae, 0x00, 0xc3, 0xac, 0x00, 0xc3, 0x84, 0x00, 0xc3, 0x85, 0x00, 0xc3, 0x89, 0x00, 0xc3, 0xa6, 0x00, 0xc3, 0x86, 0x00, 0xc3, 0xb4, 0x00, 0xc3, 0xb6, 0x00, 0xc3, 0xb2, 0x00, 0xc3, 0xbb, 0x00, 0xc3, 0xb9, 0x00, 0xc3, 0xbf, 0x00, 0xc3, 0x96, 0x00, 0xc3, 0x9c, 0x00, 0xc2, 0xa2, 0x00, 0xc2, 0xa3, 0x00, 0xc2, 0xa5, 0x00, 0xe2, 0x82, 0xa7, 0xc6, 0x92, 0x00, 0xc3, 0xa1, 0x00, 0xc3, 0xad, 0x00, 0xc3, 0xb3, 0x00, 0xc3, 0xba, 0x00, 0xc3, 0xb1, 0x00, 0xc3, 0x91, 0x00, 0xc2, 0xaa, 0x00, 0xc2, 0xba, 0x00, 0xc2, 0xbf, 0x00, 0xe2, 0x8c, 0x90, 0xc2, 0xac, 0x00, 0xc2, 0xbd, 0x00, 0xc2, 0xbc, 0x00, 0xc2, 0xa1, 0x00, 0xc2, 0xab, 0x00, 0xc2, 0xbb, 0x00, 0xe2, 0x96, 0x91, 0xe2, 0x96, 0x92, 0xe2, 0x96, 0x93, 0xe2, 0x94, 0x82, 0xe2, 0x94, 0xa4, 0xe2, 0x95, 0xa1, 0xe2, 0x95, 0xa2, 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, 0x8c, 0xa1, 0xc3, 0xb7, 0x00, 0xe2, 0x89, 0x88, 0xc2, 0xb0, 0x00, 0xe2, 0x88, 0x99, 0xc2, 0xb7, 0x00, 0xe2, 0x88, 0x9a, 0xe2, 0x81, 0xbf, 0xc2, 0xb2, 0x00, 0xe2, 0x96, 0xa0, 0xc2, 0xa0, 0x00, }; int cp437toutf8(uint8_t *o, int osz, const uint8_t *s, int sz) { int i, n; for(i = 0; i < sz && osz > 1 && s[i] != 0; i++){ if(s[i] < 127){ *o++ = s[i]; osz--; continue; } if(osz < UTFmax) break; n = (s[i] - 127) * 3; *o++ = rh[n++]; *o++ = rh[n++]; osz -= 2; if(rh[n] != 0){ *o++ = rh[n]; osz--; } } *o = 0; return i; }