1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: encoding.C |
2 | * File: encoding.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> |
6 | * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com> |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
… | |
… | |
47 | { "ISO885913", CS_ISO8859_13 }, |
47 | { "ISO885913", CS_ISO8859_13 }, |
48 | { "ISO885914", CS_ISO8859_14 }, |
48 | { "ISO885914", CS_ISO8859_14 }, |
49 | { "ISO885915", CS_ISO8859_15 }, |
49 | { "ISO885915", CS_ISO8859_15 }, |
50 | { "FCD885915", CS_ISO8859_15 }, |
50 | { "FCD885915", CS_ISO8859_15 }, |
51 | { "ISO885916", CS_ISO8859_16 }, |
51 | { "ISO885916", CS_ISO8859_16 }, |
52 | |
52 | |
53 | { "TIS620*", CS_ISO8859_11 }, // close enough |
53 | { "TIS620*", CS_ISO8859_11 }, // close enough |
54 | |
54 | |
55 | { "ISO10646*", CS_UNICODE }, |
55 | { "ISO10646*", CS_UNICODE }, |
56 | { "UNICODE", CS_UNICODE }, |
56 | { "UNICODE", CS_UNICODE }, |
57 | { "UTF8", CS_UNICODE }, |
57 | { "UTF8", CS_UNICODE }, |
58 | |
58 | |
59 | { "ASCII", CS_US_ASCII }, |
59 | { "ASCII", CS_US_ASCII }, |
60 | { "USASCII", CS_US_ASCII }, |
60 | { "USASCII", CS_US_ASCII }, |
61 | { "ANSIX341968", CS_US_ASCII }, |
61 | { "ANSIX341968", CS_US_ASCII }, |
62 | |
62 | { "ISO646.1991-IRV", CS_US_ASCII }, // older versions used the currency sign |
|
|
63 | |
63 | { "KOI8R", CS_KOI8_R }, |
64 | { "KOI8R*", CS_KOI8_R }, |
64 | { "GOST1976874*", CS_KOI8_R }, |
65 | { "GOST1976874*", CS_KOI8_R }, |
65 | { "KOI8RU", CS_KOI8_U }, |
66 | { "KOI8RU", CS_KOI8_U }, |
66 | { "KOI8U", CS_KOI8_U }, |
67 | { "KOI8U", CS_KOI8_U }, |
67 | |
68 | |
68 | { "VISCII*", CS_VISCII }, |
69 | { "VISCII*", CS_VISCII }, |
69 | |
70 | |
70 | { "JISX0201*", CS_JIS0201_1976_0 }, |
71 | { "JISX0201*", CS_JIS0201_1976_0 }, |
71 | { "JISC6226*", CS_JIS0208_1990_0 }, // also wrongly matches -1987-0? (check Encode::JP) |
72 | { "JISC6226*", CS_JIS0208_1990_0 }, // also wrongly matches -1987-0? (check Encode::JP) |
72 | { "JISX0208*", CS_JIS0208_1990_0 }, // also wrongly matches -1987-0? (check Encode::JP) |
73 | { "JISX0208*", CS_JIS0208_1990_0 }, // also wrongly matches -1987-0? (check Encode::JP) |
73 | { "JISX0212*", CS_JIS0212_1990_0 }, |
74 | { "JISX0212*", CS_JIS0212_1990_0 }, |
74 | { "JISX021320001", CS_JIS0213_1 }, |
75 | { "JISX021320001", CS_JIS0213_1 }, |
75 | { "JISX021320002", CS_JIS0213_2 }, |
76 | { "JISX021320002", CS_JIS0213_2 }, |
76 | { "JISX0221*", CS_UNICODE }, // _very_ close |
77 | { "JISX0221*", CS_UNICODE }, // _very_ close |
77 | |
78 | |
78 | { "KSC5601*", CS_KSC5601_1987_0 }, |
79 | { "KSC5601*", CS_KSC5601_1987_0 }, |
79 | { "KSX1001*", CS_KSC5601_1987_0 }, |
80 | { "KSX1001*", CS_KSC5601_1987_0 }, |
80 | { "KSC5700*", CS_UNICODE }, // unicode plus extensions |
81 | { "KSC5700*", CS_UNICODE }, // unicode plus extensions |
81 | |
82 | |
82 | { "BIG5P*", CS_BIG5_PLUS }, |
83 | { "BIG5P*", CS_BIG5_PLUS }, |
83 | { "BIG5ETEN*", CS_BIG5_EXT }, |
84 | { "BIG5ETEN*", CS_BIG5_EXT }, |
84 | { "BIG5*", CS_BIG5 }, |
85 | { "BIG5*", CS_BIG5 }, |
85 | { "GB2312*", CS_GB2312_1980_0 }, |
86 | { "GB2312*", CS_GB2312_1980_0 }, |
86 | { "GBK*", CS_GBK_0 }, |
87 | { "GBK*", CS_GBK_0 }, |
… | |
… | |
217 | #if ENCODING_TO_UNICODE |
218 | #if ENCODING_TO_UNICODE |
218 | # define ENC(base) { cs_ ## base ## _from_unicode, cs_ ## base ## _to_unicode } |
219 | # define ENC(base) { cs_ ## base ## _from_unicode, cs_ ## base ## _to_unicode } |
219 | #else |
220 | #else |
220 | # define ENC(base) { cs_ ## base ## _from_unicode } |
221 | # define ENC(base) { cs_ ## base ## _from_unicode } |
221 | #endif |
222 | #endif |
222 | |
223 | |
223 | |
224 | |
224 | // order must match table in encoding.h(!) |
225 | // order must match table in encoding.h(!) |
225 | const rxvt_codeset_conv rxvt_codeset[NUM_CODESETS] = { |
226 | const rxvt_codeset_conv rxvt_codeset[NUM_CODESETS] = { |
226 | ENC (unknown), |
227 | ENC (unknown), |
227 | |
228 | |
… | |
… | |
287 | { |
288 | { |
288 | int l = 0; |
289 | int l = 0; |
289 | int r = sizeof (rxvt_compose_table) / sizeof (rxvt_compose_entry) - 1; |
290 | int r = sizeof (rxvt_compose_table) / sizeof (rxvt_compose_entry) - 1; |
290 | int m; |
291 | int m; |
291 | |
292 | |
292 | while (r > l) |
293 | while (r >= l) |
293 | { |
294 | { |
294 | m = (l + r) / 2; |
295 | m = (l + r) / 2; |
295 | rxvt_compose_entry &c = rxvt_compose_table[m]; |
296 | rxvt_compose_entry &c = rxvt_compose_table[m]; |
296 | |
297 | |
297 | if (c.c1 < c1 || (c.c1 == c1 && c.c2 < c2)) |
298 | if (c.c1 < c1 || (c.c1 == c1 && c.c2 < c2)) |