00001
00002
00003
00004
00005
00006
00007 #ifndef API_HAVE_CHARSET_ALIAS_TABLE
00008 #define API_HAVE_CHARSET_ALIAS_TABLE
00009
00010 #include <stdlib.h>
00011 #include <string.h>
00012
00013
00014 static struct charset_alias {
00015 const char *name;
00016 const char *target;
00017 } const charset_alias_list[] = {
00018 {"424", "cp424"},
00019 {"437", "cp437"},
00020 {"646", "us-ascii"},
00021 {"646ca", "iso-ir-121"},
00022 {"646ca2", "iso-ir-122"},
00023 {"646cu", "iso-ir-151"},
00024 {"646de", "iso-ir-21"},
00025 {"646dk", "iso646-dk"},
00026 {"646es", "iso-ir-17"},
00027 {"646es2", "iso-ir-85"},
00028 {"646fi", "iso-ir-10"},
00029 {"646fr", "iso-ir-69"},
00030 {"646fr1", "iso-ir-25"},
00031 {"646gb", "iso-ir-4"},
00032 {"646hu", "iso-ir-86"},
00033 {"646it", "iso-ir-15"},
00034 {"646jp", "iso-ir-14"},
00035 {"646kr", "iso646-kr"},
00036 {"646no", "iso-ir-60"},
00037 {"646no2", "iso-ir-61"},
00038 {"646pt", "iso-ir-16"},
00039 {"646pt2", "iso-ir-84"},
00040 {"646se", "iso-ir-10"},
00041 {"646se2", "iso-ir-11"},
00042 {"646us", "us-ascii"},
00043 {"646yu", "iso-ir-141"},
00044 {"850", "cp850"},
00045 {"851", "cp851"},
00046 {"852", "cp852"},
00047 {"855", "cp855"},
00048 {"857", "cp857"},
00049 {"860", "cp860"},
00050 {"861", "cp861"},
00051 {"862", "cp862"},
00052 {"863", "cp863"},
00053 {"865", "cp865"},
00054 {"866", "cp866"},
00055 {"869", "cp869"},
00056 {"8859", "iso-8859-1"},
00057 {"904", "cp904"},
00058 {"ansi_x3.110-1983", "iso-ir-99"},
00059 {"ansi_x3.4-1968", "us-ascii"},
00060 {"ansi_x3.4-1986", "us-ascii"},
00061 {"arabic", "iso-8859-6"},
00062 {"arabic7", "iso-ir-89"},
00063 {"ascii", "us-ascii"},
00064 {"asmo-708", "iso-8859-6"},
00065 {"asmo_449", "iso-ir-89"},
00066 {"bs_4730", "iso-ir-4"},
00067 {"bs_viewdata", "iso-ir-47"},
00068 {"ca", "iso-ir-121"},
00069 {"chinese", "gb_2312-80"},
00070 {"cp-ar", "cp868"},
00071 {"cp-gr", "cp869"},
00072 {"cp-is", "cp861"},
00073 {"cp037_ibmuscanada", "cp037"},
00074 {"cp10000_macroman", "cp10000"},
00075 {"cp10006_macgreek", "cp10006"},
00076 {"cp10007_maccyrillic", "cp10007"},
00077 {"cp10029_maclatin2", "cp10029"},
00078 {"cp10079_macicelandic", "cp10079"},
00079 {"cp10081_macturkish", "cp10081"},
00080 {"cp1250", "windows-1250"},
00081 {"cp1251", "windows-1251"},
00082 {"cp1252", "windows-1252"},
00083 {"cp1253", "windows-1253"},
00084 {"cp1254", "windows-1254"},
00085 {"cp1255", "windows-1255"},
00086 {"cp1256", "windows-1256"},
00087 {"cp1257", "windows-1257"},
00088 {"cp1258", "windows-1258"},
00089 {"cp367", "us-ascii"},
00090 {"cp737latingreek", "cp737"},
00091 {"cp819", "iso-8859-1"},
00092 {"cp856_hebrew_pc", "cp856"},
00093 {"cp875_ibmgreek", "cp875"},
00094 {"csa7-1", "iso-ir-121"},
00095 {"csa7-2", "iso-ir-122"},
00096 {"csa_t500-1983", "iso-ir-99"},
00097 {"csa_z243.4-1985-1", "iso-ir-121"},
00098 {"csa_z243.4-1985-2", "iso-ir-122"},
00099 {"csa_z243.4-1985-gr", "iso-ir-123"},
00100 {"csascii", "us-ascii"},
00101 {"csbig5", "big5"},
00102 {"cshalfwidthkatakana", "jis_x0201"},
00103 {"csibm1026", "cp1026"},
00104 {"csibm424", "cp424"},
00105 {"csibm500", "cp500"},
00106 {"csibm855", "cp855"},
00107 {"csibm857", "cp857"},
00108 {"csibm860", "cp860"},
00109 {"csibm861", "cp861"},
00110 {"csibm863", "cp863"},
00111 {"csibm864", "cp864"},
00112 {"csibm865", "cp865"},
00113 {"csibm866", "cp866"},
00114 {"csibm869", "cp869"},
00115 {"csiso2022jp", "iso-2022-jp"},
00116 {"csiso2022jp2", "iso-2022-jp-2"},
00117 {"csisolatin1", "iso-8859-1"},
00118 {"csisolatin2", "iso-8859-2"},
00119 {"csisolatin3", "iso-8859-3"},
00120 {"csisolatin4", "iso-8859-4"},
00121 {"csisolatin5", "iso-8859-9"},
00122 {"csisolatin6", "iso-8859-10"},
00123 {"csisolatinarabic", "iso-8859-6"},
00124 {"csisolatincyrillic", "iso-8859-5"},
00125 {"csisolatingreek", "iso-8859-7"},
00126 {"csisolatinhebrew", "iso-8859-8"},
00127 {"cskoi8r", "koi8-r"},
00128 {"csn_369103", "iso-ir-139"},
00129 {"cspc775baltic", "cp775"},
00130 {"cspc850multilingual", "cp850"},
00131 {"cspc862latinhebrew", "cp862"},
00132 {"cspc8codepage437", "cp437"},
00133 {"cspcp852", "cp852"},
00134 {"csshiftjis", "shift_jis"},
00135 {"cuba", "iso-ir-151"},
00136 {"cyrillic", "iso-8859-5"},
00137 {"de", "iso-ir-21"},
00138 {"dec", "dec-mcs"},
00139 {"din_66003", "iso-ir-21"},
00140 {"dk", "iso646-dk"},
00141 {"ds2089", "iso646-dk"},
00142 {"ds_2089", "iso646-dk"},
00143 {"e13b", "iso-ir-98"},
00144 {"ebcdic-be", "cp274"},
00145 {"ebcdic-br", "cp275"},
00146 {"ebcdic-cp-ar1", "cp420"},
00147 {"ebcdic-cp-ar2", "cp918"},
00148 {"ebcdic-cp-be", "cp500"},
00149 {"ebcdic-cp-ca", "cp037"},
00150 {"ebcdic-cp-ch", "cp500"},
00151 {"ebcdic-cp-dk", "cp277"},
00152 {"ebcdic-cp-es", "cp284"},
00153 {"ebcdic-cp-fi", "cp278"},
00154 {"ebcdic-cp-fr", "cp297"},
00155 {"ebcdic-cp-gb", "cp285"},
00156 {"ebcdic-cp-gr", "cp423"},
00157 {"ebcdic-cp-he", "cp424"},
00158 {"ebcdic-cp-is", "cp871"},
00159 {"ebcdic-cp-it", "cp280"},
00160 {"ebcdic-cp-nl", "cp037"},
00161 {"ebcdic-cp-no", "cp277"},
00162 {"ebcdic-cp-roece", "cp870"},
00163 {"ebcdic-cp-se", "cp278"},
00164 {"ebcdic-cp-tr", "cp905"},
00165 {"ebcdic-cp-us", "cp037"},
00166 {"ebcdic-cp-wt", "cp037"},
00167 {"ebcdic-cp-yu", "cp870"},
00168 {"ebcdic-cyrillic", "cp880"},
00169 {"ebcdic-int", "cp038"},
00170 {"ebcdic-jp-e", "cp281"},
00171 {"ebcdic-jp-kana", "cp290"},
00172 {"ecma-114", "iso-8859-6"},
00173 {"ecma-118", "iso-8859-7"},
00174 {"ecma-cyrillic", "iso-ir-111"},
00175 {"edf04", "osd_ebcdic_df04_1"},
00176 {"edf04-1", "osd_ebcdic_df04_1"},
00177 {"edf04-15", "osd_ebcdic_df04_15"},
00178 {"elot_928", "iso-8859-7"},
00179 {"es", "iso-ir-17"},
00180 {"es2", "iso-ir-85"},
00181 {"fi", "iso-ir-10"},
00182 {"fr", "iso-ir-69"},
00183 {"gb", "iso-ir-4"},
00184 {"gb_1988-80", "iso-ir-57"},
00185 {"gost_19768-74", "iso-ir-153"},
00186 {"greek", "iso-8859-7"},
00187 {"greek-ccitt", "iso-ir-150"},
00188 {"greek7", "iso-ir-88"},
00189 {"greek7-old", "iso-ir-18"},
00190 {"greek8", "iso-8859-7"},
00191 {"hebrew", "iso-8859-8"},
00192 {"hu", "iso-ir-86"},
00193 {"ibm037", "cp037"},
00194 {"ibm038", "cp038"},
00195 {"ibm1026", "cp1026"},
00196 {"ibm273", "cp273"},
00197 {"ibm274", "cp274"},
00198 {"ibm275", "cp275"},
00199 {"ibm277", "cp277"},
00200 {"ibm278", "cp278"},
00201 {"ibm280", "cp280"},
00202 {"ibm281", "cp281"},
00203 {"ibm284", "cp284"},
00204 {"ibm285", "cp285"},
00205 {"ibm290", "cp290"},
00206 {"ibm297", "cp297"},
00207 {"ibm367", "us-ascii"},
00208 {"ibm420", "cp420"},
00209 {"ibm423", "cp423"},
00210 {"ibm424", "cp424"},
00211 {"ibm437", "cp437"},
00212 {"ibm500", "cp500"},
00213 {"ibm737", "cp737"},
00214 {"ibm775", "cp775"},
00215 {"ibm819", "iso-8859-1"},
00216 {"ibm850", "cp850"},
00217 {"ibm851", "cp851"},
00218 {"ibm852", "cp852"},
00219 {"ibm855", "cp855"},
00220 {"ibm857", "cp857"},
00221 {"ibm860", "cp860"},
00222 {"ibm861", "cp861"},
00223 {"ibm862", "cp862"},
00224 {"ibm863", "cp863"},
00225 {"ibm864", "cp864"},
00226 {"ibm865", "cp865"},
00227 {"ibm866", "cp866"},
00228 {"ibm868", "cp868"},
00229 {"ibm869", "cp869"},
00230 {"ibm870", "cp870"},
00231 {"ibm871", "cp871"},
00232 {"ibm874", "cp874"},
00233 {"ibm880", "cp880"},
00234 {"ibm891", "cp891"},
00235 {"ibm903", "cp903"},
00236 {"ibm904", "cp904"},
00237 {"ibm905", "cp905"},
00238 {"ibm918", "cp918"},
00239 {"iec_p27-1", "iso-ir-143"},
00240 {"inis", "iso-ir-49"},
00241 {"inis-8", "iso-ir-50"},
00242 {"inis-cyrillic", "iso-ir-51"},
00243 {"irv", "iso-ir-2"},
00244 {"iso-ir-100", "iso-8859-1"},
00245 {"iso-ir-101", "iso-8859-2"},
00246 {"iso-ir-109", "iso-8859-3"},
00247 {"iso-ir-110", "iso-8859-4"},
00248 {"iso-ir-126", "iso-8859-7"},
00249 {"iso-ir-127", "iso-8859-6"},
00250 {"iso-ir-138", "iso-8859-8"},
00251 {"iso-ir-144", "iso-8859-5"},
00252 {"iso-ir-148", "iso-8859-9"},
00253 {"iso-ir-157", "iso-8859-10"},
00254 {"iso-ir-58", "gb_2312-80"},
00255 {"iso-ir-87", "jis_x0208-1983"},
00256 {"iso646-ca", "iso-ir-121"},
00257 {"iso646-ca2", "iso-ir-122"},
00258 {"iso646-cu", "iso-ir-151"},
00259 {"iso646-de", "iso-ir-21"},
00260 {"iso646-es", "iso-ir-17"},
00261 {"iso646-es2", "iso-ir-85"},
00262 {"iso646-fi", "iso-ir-10"},
00263 {"iso646-fr", "iso-ir-69"},
00264 {"iso646-fr1", "iso-ir-25"},
00265 {"iso646-gb", "iso-ir-4"},
00266 {"iso646-hu", "iso-ir-86"},
00267 {"iso646-it", "iso-ir-15"},
00268 {"iso646-jp", "iso-ir-14"},
00269 {"iso646-jp-ocr-a", "iso-ir-91"},
00270 {"iso646-jp-ocr-b", "iso-ir-92"},
00271 {"iso646-no", "iso-ir-60"},
00272 {"iso646-no2", "iso-ir-61"},
00273 {"iso646-pt", "iso-ir-16"},
00274 {"iso646-pt2", "iso-ir-84"},
00275 {"iso646-se", "iso-ir-10"},
00276 {"iso646-se2", "iso-ir-11"},
00277 {"iso646-us", "us-ascii"},
00278 {"iso646-yu", "iso-ir-141"},
00279 {"iso8859-1", "iso-8859-1"},
00280 {"iso8859-10", "iso-8859-10"},
00281 {"iso8859-13", "iso-8859-13"},
00282 {"iso8859-14", "iso-8859-14"},
00283 {"iso8859-15", "iso-8859-15"},
00284 {"iso8859-2", "iso-8859-2"},
00285 {"iso8859-3", "iso-8859-3"},
00286 {"iso8859-4", "iso-8859-4"},
00287 {"iso8859-5", "iso-8859-5"},
00288 {"iso8859-6", "iso-8859-6"},
00289 {"iso8859-7", "iso-8859-7"},
00290 {"iso8859-8", "iso-8859-8"},
00291 {"iso8859-9", "iso-8859-9"},
00292 {"iso_10367-box", "iso-ir-155"},
00293 {"iso_2033-1983", "iso-ir-98"},
00294 {"iso_5427", "iso-ir-37"},
00295 {"iso_5427:1981", "iso-ir-54"},
00296 {"iso_5428:1980", "iso-ir-55"},
00297 {"iso_646.irv:1983", "iso-ir-2"},
00298 {"iso_646.irv:1991", "us-ascii"},
00299 {"iso_6937-2-25", "iso-ir-152"},
00300 {"iso_6937-2-add", "iso-ir-142"},
00301 {"iso_8859-1", "iso-8859-1"},
00302 {"iso_8859-10", "iso-8859-10"},
00303 {"iso_8859-10:1992", "iso-8859-10"},
00304 {"iso_8859-13", "iso-8859-13"},
00305 {"iso_8859-13:1998", "iso-8859-13"},
00306 {"iso_8859-14", "iso-8859-14"},
00307 {"iso_8859-14:1998", "iso-8859-14"},
00308 {"iso_8859-15", "iso-8859-15"},
00309 {"iso_8859-15:1998", "iso-8859-15"},
00310 {"iso_8859-1:1987", "iso-8859-1"},
00311 {"iso_8859-2", "iso-8859-2"},
00312 {"iso_8859-2:1987", "iso-8859-2"},
00313 {"iso_8859-3", "iso-8859-3"},
00314 {"iso_8859-3:1988", "iso-8859-3"},
00315 {"iso_8859-4", "iso-8859-4"},
00316 {"iso_8859-4:1988", "iso-8859-4"},
00317 {"iso_8859-5", "iso-8859-5"},
00318 {"iso_8859-5:1988", "iso-8859-5"},
00319 {"iso_8859-6", "iso-8859-6"},
00320 {"iso_8859-6:1987", "iso-8859-6"},
00321 {"iso_8859-7", "iso-8859-7"},
00322 {"iso_8859-7:1987", "iso-8859-7"},
00323 {"iso_8859-8", "iso-8859-8"},
00324 {"iso_8859-8:1988", "iso-8859-8"},
00325 {"iso_8859-9", "iso-8859-9"},
00326 {"iso_8859-9:1989", "iso-8859-9"},
00327 {"iso_8859-supp", "iso-ir-154"},
00328 {"iso_9036", "iso-ir-89"},
00329 {"it", "iso-ir-15"},
00330 {"jis_c6220-1969", "iso-ir-13"},
00331 {"jis_c6220-1969-jp", "iso-ir-13"},
00332 {"jis_c6220-1969-ro", "iso-ir-14"},
00333 {"jis_c6226-1983", "jis_x0208-1983"},
00334 {"jis_c6229-1984-a", "iso-ir-91"},
00335 {"jis_c6229-1984-b", "iso-ir-92"},
00336 {"jis_c6229-1984-b-add", "iso-ir-93"},
00337 {"jis_c6229-1984-hand", "iso-ir-94"},
00338 {"jis_c6229-1984-hand-add", "iso-ir-95"},
00339 {"jis_c6229-1984-kana", "iso-ir-96"},
00340 {"jp", "iso-ir-14"},
00341 {"jp-ocr-a", "iso-ir-91"},
00342 {"jp-ocr-b", "iso-ir-92"},
00343 {"jp-ocr-b-add", "iso-ir-93"},
00344 {"jp-ocr-hand", "iso-ir-94"},
00345 {"jp-ocr-hand-add", "iso-ir-95"},
00346 {"js", "iso-ir-141"},
00347 {"jus_i.b1.002", "iso-ir-141"},
00348 {"jus_i.b1.003-mac", "iso-ir-147"},
00349 {"jus_i.b1.003-serb", "iso-ir-146"},
00350 {"katakana", "iso-ir-13"},
00351 {"ks_x_1001", "ksx1001"},
00352 {"ksc5636", "iso646-kr"},
00353 {"l1", "iso-8859-1"},
00354 {"l2", "iso-8859-2"},
00355 {"l3", "iso-8859-3"},
00356 {"l4", "iso-8859-4"},
00357 {"l5", "iso-8859-9"},
00358 {"l6", "iso-8859-10"},
00359 {"lap", "iso-ir-158"},
00360 {"latin-greek", "iso-ir-19"},
00361 {"latin-greek-1", "iso-ir-27"},
00362 {"latin-lap", "iso-ir-158"},
00363 {"latin1", "iso-8859-1"},
00364 {"latin1-2-5", "iso-ir-154"},
00365 {"latin2", "iso-8859-2"},
00366 {"latin3", "iso-8859-3"},
00367 {"latin4", "iso-8859-4"},
00368 {"latin5", "iso-8859-9"},
00369 {"latin6", "iso-8859-10"},
00370 {"mac", "macintosh"},
00371 {"maccenteuro", "mac-ce"},
00372 {"maccroatian", "mac-croatian"},
00373 {"maccyrillic", "mac-cyrillic"},
00374 {"macdingbats", "mac-dingbats"},
00375 {"macedonian", "iso-ir-147"},
00376 {"macgreek", "mac-greek"},
00377 {"maciceland", "mac-iceland"},
00378 {"macroman", "mac-roman"},
00379 {"macromania", "mac-romania"},
00380 {"macthai", "mac-thai"},
00381 {"macturkish", "mac-turkish"},
00382 {"macukraine", "mac-ukraine"},
00383 {"ms_kanji", "shift_jis"},
00384 {"msz_7795.3", "iso-ir-86"},
00385 {"naplps", "iso-ir-99"},
00386 {"nats-dano", "iso-ir-9-1"},
00387 {"nats-dano-add", "iso-ir-9-2"},
00388 {"nats-sefi", "iso-ir-8-1"},
00389 {"nats-sefi-add", "iso-ir-8-2"},
00390 {"nc_nc00-10:81", "iso-ir-151"},
00391 {"nf_z_62-010", "iso-ir-69"},
00392 {"nf_z_62-010_(1973)", "iso-ir-25"},
00393 {"no", "iso-ir-60"},
00394 {"no2", "iso-ir-61"},
00395 {"ns_4551-1", "iso-ir-60"},
00396 {"ns_4551-2", "iso-ir-61"},
00397 {"pt", "iso-ir-16"},
00398 {"pt2", "iso-ir-84"},
00399 {"r8", "hp-roman8"},
00400 {"roman8", "hp-roman8"},
00401 {"se", "iso-ir-10"},
00402 {"se2", "iso-ir-11"},
00403 {"sen_850200_b", "iso-ir-10"},
00404 {"sen_850200_c", "iso-ir-11"},
00405 {"serbian", "iso-ir-146"},
00406 {"st_sev_358-88", "iso-ir-153"},
00407 {"t.101-g2", "iso-ir-128"},
00408 {"t.61", "iso-ir-103"},
00409 {"t.61-7bit", "iso-ir-102"},
00410 {"t.61-8bit", "iso-ir-103"},
00411 {"uk", "iso-ir-4"},
00412 {"us", "us-ascii"},
00413 {"utf-7", "unicode-1-1-utf-7"},
00414 {"videotex-suppl", "iso-ir-70"},
00415 {"x0201", "jis_x0201"},
00416 {"x0201-7", "iso-ir-13"},
00417 {"x0208", "jis_x0208-1983"},
00418 {"yu", "iso-ir-141"},
00419 {NULL, NULL} };
00420
00421 static const size_t charset_alias_count =
00422 sizeof(charset_alias_list)/sizeof(charset_alias_list[0]) - 1;
00423
00424
00425 static int charset_alias_compare (const void *u, const void *v)
00426 {
00427 const struct charset_alias *const a = u;
00428 const struct charset_alias *const b = v;
00429 return strcmp(a->name, b->name);
00430 }
00431
00432
00433
00434 static const char *charset_alias_find (const char *name)
00435 {
00436 struct charset_alias key;
00437 struct charset_alias *alias;
00438 #if 'A' == '\xC1'
00439
00440
00441
00442
00443
00444
00445
00446 if (isdigit(charset_alias_list[0].name[0])) {
00447 qsort((void *)charset_alias_list, charset_alias_count,
00448 sizeof(charset_alias_list[0]),
00449 charset_alias_compare);
00450 }
00451 #endif
00452 key.name = name;
00453 alias = bsearch(&key, charset_alias_list, charset_alias_count,
00454 sizeof(charset_alias_list[0]),
00455 charset_alias_compare);
00456 if (alias)
00457 return alias->target;
00458 else
00459 return NULL;
00460 }
00461
00462 #endif