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 }, |
|
|
87 | { "GBK*", CS_GBK_0 }, |
86 | { "GB6345*", CS_GB2312_1980_0 }, // slightly different to gb2312?? |
88 | { "GB6345*", CS_GB2312_1980_0 }, // slightly different to gb2312?? |
87 | { "GB8565*", CS_GB2312_1980_0 }, // a superset of gb2312?? |
89 | { "GB8565*", CS_GB2312_1980_0 }, // a superset of gb2312?? |
88 | { "GB13000*", CS_UNICODE }, |
90 | { "GB13000*", CS_UNICODE }, |
89 | { "CNS1164319921", CS_CNS11643_1992_1 }, |
91 | { "CNS1164319921", CS_CNS11643_1992_1 }, |
90 | { "CNS1164319922", CS_CNS11643_1992_2 }, |
92 | { "CNS1164319922", CS_CNS11643_1992_2 }, |
… | |
… | |
177 | |
179 | |
178 | //#define ENCODING_KR |
180 | //#define ENCODING_KR |
179 | |
181 | |
180 | #include "table/ksc5601_1987_0.h" |
182 | #include "table/ksc5601_1987_0.h" |
181 | |
183 | |
182 | //#define ENCODING_CN |
184 | //#define ENCODING_ZH |
183 | |
185 | |
|
|
186 | #include "table/big5.h" |
|
|
187 | #include "table/gbk_0.h" |
184 | #include "table/gb2312_1980_0.h" |
188 | #include "table/gb2312_1980_0.h" |
185 | #include "table/big5.h" |
|
|
186 | |
189 | |
187 | //#define ENCODING_CN_EXT |
190 | //#define ENCODING_ZH_EXT |
188 | |
191 | |
189 | #include "table/cns11643_1992_1.h" |
192 | #include "table/cns11643_1992_1.h" |
190 | #include "table/cns11643_1992_2.h" |
193 | #include "table/cns11643_1992_2.h" |
191 | #include "table/cns11643_1992_3.h" |
194 | #include "table/cns11643_1992_3.h" |
192 | #include "table/cns11643_1992_4.h" |
195 | #include "table/cns11643_1992_4.h" |
… | |
… | |
215 | #if ENCODING_TO_UNICODE |
218 | #if ENCODING_TO_UNICODE |
216 | # define ENC(base) { cs_ ## base ## _from_unicode, cs_ ## base ## _to_unicode } |
219 | # define ENC(base) { cs_ ## base ## _from_unicode, cs_ ## base ## _to_unicode } |
217 | #else |
220 | #else |
218 | # define ENC(base) { cs_ ## base ## _from_unicode } |
221 | # define ENC(base) { cs_ ## base ## _from_unicode } |
219 | #endif |
222 | #endif |
220 | |
223 | |
221 | |
224 | |
222 | // order must match table in encoding.h(!) |
225 | // order must match table in encoding.h(!) |
223 | const rxvt_codeset_conv rxvt_codeset[NUM_CODESETS] = { |
226 | const rxvt_codeset_conv rxvt_codeset[NUM_CODESETS] = { |
224 | ENC (unknown), |
227 | ENC (unknown), |
225 | |
228 | |
… | |
… | |
252 | ENC (jis0213_2), |
255 | ENC (jis0213_2), |
253 | |
256 | |
254 | ENC (ksc5601_1987_0), |
257 | ENC (ksc5601_1987_0), |
255 | |
258 | |
256 | ENC (gb2312_1980_0), |
259 | ENC (gb2312_1980_0), |
|
|
260 | ENC (gbk_0), |
257 | |
261 | |
258 | ENC (cns11643_1992_1), |
262 | ENC (cns11643_1992_1), |
259 | ENC (cns11643_1992_2), |
263 | ENC (cns11643_1992_2), |
260 | ENC (cns11643_1992_3), |
264 | ENC (cns11643_1992_3), |
261 | ENC (cns11643_1992_4), |
265 | ENC (cns11643_1992_4), |