1#! /bin/sh
2# Output a system dependent table of character encoding aliases.
3#
4#   Copyright (C) 2000-2001 Free Software Foundation, Inc.
5#
6#   This program is free software; you can redistribute it and/or modify it
7#   under the terms of the GNU Library General Public License as published
8#   by the Free Software Foundation; either version 2, or (at your option)
9#   any later version.
10#
11#   This program is distributed in the hope that it will be useful,
12#   but WITHOUT ANY WARRANTY; without even the implied warranty of
13#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14#   Library General Public License for more details.
15#
16#   You should have received a copy of the GNU Library General Public
17#   License along with this program; if not, write to the Free Software
18#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19#   USA.
20#
21# The table consists of lines of the form
22#    ALIAS  CANONICAL
23#
24# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
25# ALIAS is compared in a case sensitive way.
26#
27# CANONICAL is the GNU canonical name for this character encoding.
28# It must be an encoding supported by libiconv. Support by GNU libc is
29# also desirable. CANONICAL is case insensitive. Usually an upper case
30# MIME charset name is preferred.
31# The current list of GNU canonical charset names is as follows.
32#
33#       name                         used by which systems         a MIME name?
34#   ASCII, ANSI_X3.4-1968     glibc solaris freebsd
35#   ISO-8859-1                glibc aix hpux irix osf solaris freebsd   yes
36#   ISO-8859-2                glibc aix hpux irix osf solaris freebsd   yes
37#   ISO-8859-3                glibc                                     yes
38#   ISO-8859-4                osf solaris freebsd                       yes
39#   ISO-8859-5                glibc aix hpux irix osf solaris freebsd   yes
40#   ISO-8859-6                glibc aix hpux solaris                    yes
41#   ISO-8859-7                glibc aix hpux irix osf solaris           yes
42#   ISO-8859-8                glibc aix hpux osf solaris                yes
43#   ISO-8859-9                glibc aix hpux irix osf solaris           yes
44#   ISO-8859-13               glibc
45#   ISO-8859-15               glibc aix osf solaris freebsd
46#   KOI8-R                    glibc solaris freebsd                     yes
47#   KOI8-U                    glibc freebsd                             yes
48#   CP437                     dos
49#   CP775                     dos
50#   CP850                     aix osf dos
51#   CP852                     dos
52#   CP855                     dos
53#   CP856                     aix
54#   CP857                     dos
55#   CP861                     dos
56#   CP862                     dos
57#   CP864                     dos
58#   CP865                     dos
59#   CP866                     freebsd dos
60#   CP869                     dos
61#   CP874                     win32 dos
62#   CP922                     aix
63#   CP932                     aix win32 dos
64#   CP943                     aix
65#   CP949                     osf win32 dos
66#   CP950                     win32 dos
67#   CP1046                    aix
68#   CP1124                    aix
69#   CP1129                    aix
70#   CP1250                    win32
71#   CP1251                    glibc win32
72#   CP1252                    aix win32
73#   CP1253                    win32
74#   CP1254                    win32
75#   CP1255                    win32
76#   CP1256                    win32
77#   CP1257                    win32
78#   GB2312                    glibc aix hpux irix solaris freebsd       yes
79#   EUC-JP                    glibc aix hpux irix osf solaris freebsd   yes
80#   EUC-KR                    glibc aix hpux irix osf solaris freebsd   yes
81#   EUC-TW                    glibc aix hpux irix osf solaris
82#   BIG5                      glibc aix hpux osf solaris freebsd        yes
83#   BIG5-HKSCS                glibc
84#   GBK                       aix osf win32 dos
85#   GB18030                   glibc
86#   SHIFT_JIS                 hpux osf solaris freebsd                  yes
87#   JOHAB                     glibc win32
88#   TIS-620                   glibc aix hpux osf solaris
89#   VISCII                    glibc                                     yes
90#   HP-ROMAN8                 hpux
91#   HP-ARABIC8                hpux
92#   HP-GREEK8                 hpux
93#   HP-HEBREW8                hpux
94#   HP-TURKISH8               hpux
95#   HP-KANA8                  hpux
96#   DEC-KANJI                 osf
97#   DEC-HANYU                 osf
98#   UTF-8                     glibc aix hpux osf solaris                yes
99#
100# Note: Names which are not marked as being a MIME name should not be used in
101# Internet protocols for information interchange (mail, news, etc.).
102#
103# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
104# must understand both names and treat them as equivalent.
105#
106# The first argument passed to this file is the canonical host specification,
107#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
108# or
109#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
110
111host="$1"
112os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
113echo "# This file contains a table of character encoding aliases,"
114echo "# suitable for operating system '${os}'."
115echo "# It was automatically generated from config.charset."
116# List of references, updated during installation:
117echo "# Packages using this file: "
118case "$os" in
119    linux* | *-gnu*)
120	# With glibc-2.1 or newer, we don't need any canonicalization,
121	# because glibc has iconv and both glibc and libiconv support all
122	# GNU canonical names directly. Therefore, the Makefile does not
123	# need to install the alias file at all.
124	# The following applies only to glibc-2.0.x and older libcs.
125	echo "ISO_646.IRV:1983 ASCII"
126	;;
127    aix*)
128	echo "ISO8859-1 ISO-8859-1"
129	echo "ISO8859-2 ISO-8859-2"
130	echo "ISO8859-5 ISO-8859-5"
131	echo "ISO8859-6 ISO-8859-6"
132	echo "ISO8859-7 ISO-8859-7"
133	echo "ISO8859-8 ISO-8859-8"
134	echo "ISO8859-9 ISO-8859-9"
135	echo "ISO8859-15 ISO-8859-15"
136	echo "IBM-850 CP850"
137	echo "IBM-856 CP856"
138	echo "IBM-921 ISO-8859-13"
139	echo "IBM-922 CP922"
140	echo "IBM-932 CP932"
141	echo "IBM-943 CP943"
142	echo "IBM-1046 CP1046"
143	echo "IBM-1124 CP1124"
144	echo "IBM-1129 CP1129"
145	echo "IBM-1252 CP1252"
146	echo "IBM-eucCN GB2312"
147	echo "IBM-eucJP EUC-JP"
148	echo "IBM-eucKR EUC-KR"
149	echo "IBM-eucTW EUC-TW"
150	echo "big5 BIG5"
151	echo "GBK GBK"
152	echo "TIS-620 TIS-620"
153	echo "UTF-8 UTF-8"
154	;;
155    hpux*)
156	echo "iso88591 ISO-8859-1"
157	echo "iso88592 ISO-8859-2"
158	echo "iso88595 ISO-8859-5"
159	echo "iso88596 ISO-8859-6"
160	echo "iso88597 ISO-8859-7"
161	echo "iso88598 ISO-8859-8"
162	echo "iso88599 ISO-8859-9"
163	echo "iso885915 ISO-8859-15"
164	echo "roman8 HP-ROMAN8"
165	echo "arabic8 HP-ARABIC8"
166	echo "greek8 HP-GREEK8"
167	echo "hebrew8 HP-HEBREW8"
168	echo "turkish8 HP-TURKISH8"
169	echo "kana8 HP-KANA8"
170	echo "tis620 TIS-620"
171	echo "big5 BIG5"
172	echo "eucJP EUC-JP"
173	echo "eucKR EUC-KR"
174	echo "eucTW EUC-TW"
175	echo "hp15CN GB2312"
176	#echo "ccdc ?" # what is this?
177	echo "SJIS SHIFT_JIS"
178	echo "utf8 UTF-8"
179	;;
180    irix*)
181	echo "ISO8859-1 ISO-8859-1"
182	echo "ISO8859-2 ISO-8859-2"
183	echo "ISO8859-5 ISO-8859-5"
184	echo "ISO8859-7 ISO-8859-7"
185	echo "ISO8859-9 ISO-8859-9"
186	echo "eucCN GB2312"
187	echo "eucJP EUC-JP"
188	echo "eucKR EUC-KR"
189	echo "eucTW EUC-TW"
190	;;
191    osf*)
192	echo "ISO8859-1 ISO-8859-1"
193	echo "ISO8859-2 ISO-8859-2"
194	echo "ISO8859-4 ISO-8859-4"
195	echo "ISO8859-5 ISO-8859-5"
196	echo "ISO8859-7 ISO-8859-7"
197	echo "ISO8859-8 ISO-8859-8"
198	echo "ISO8859-9 ISO-8859-9"
199	echo "ISO8859-15 ISO-8859-15"
200	echo "cp850 CP850"
201	echo "big5 BIG5"
202	echo "dechanyu DEC-HANYU"
203	echo "dechanzi GB2312"
204	echo "deckanji DEC-KANJI"
205	echo "deckorean EUC-KR"
206	echo "eucJP EUC-JP"
207	echo "eucKR EUC-KR"
208	echo "eucTW EUC-TW"
209	echo "GBK GBK"
210	echo "KSC5601 CP949"
211	echo "sdeckanji EUC-JP"
212	echo "SJIS SHIFT_JIS"
213	echo "TACTIS TIS-620"
214	echo "UTF-8 UTF-8"
215	;;
216    solaris*)
217	echo "646 ASCII"
218	echo "ISO8859-1 ISO-8859-1"
219	echo "ISO8859-2 ISO-8859-2"
220	echo "ISO8859-4 ISO-8859-4"
221	echo "ISO8859-5 ISO-8859-5"
222	echo "ISO8859-6 ISO-8859-6"
223	echo "ISO8859-7 ISO-8859-7"
224	echo "ISO8859-8 ISO-8859-8"
225	echo "ISO8859-9 ISO-8859-9"
226	echo "ISO8859-15 ISO-8859-15"
227	echo "koi8-r KOI8-R"
228	echo "BIG5 BIG5"
229	echo "gb2312 GB2312"
230	echo "cns11643 EUC-TW"
231	echo "5601 EUC-KR"
232	echo "eucJP EUC-JP"
233	echo "PCK SHIFT_JIS"
234	echo "TIS620.2533 TIS-620"
235	#echo "sun_eu_greek ?" # what is this?
236	echo "UTF-8 UTF-8"
237	;;
238    freebsd*)
239	# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
240	# localcharset.c falls back to using the full locale name
241	# from the environment variables.
242	echo "C ASCII"
243	echo "US-ASCII ASCII"
244	for l in la_LN lt_LN; do
245	  echo "$l.ASCII ASCII"
246	done
247	for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
248	         fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
249	         lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
250	  echo "$l.ISO_8859-1 ISO-8859-1"
251	  echo "$l.DIS_8859-15 ISO-8859-15"
252	done
253	for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
254	  echo "$l.ISO_8859-2 ISO-8859-2"
255	done
256	for l in la_LN lt_LT; do
257	  echo "$l.ISO_8859-4 ISO-8859-4"
258	done
259	for l in ru_RU ru_SU; do
260	  echo "$l.KOI8-R KOI8-R"
261	  echo "$l.ISO_8859-5 ISO-8859-5"
262	  echo "$l.CP866 CP866"
263	done
264	echo "uk_UA.KOI8-U KOI8-U"
265	echo "zh_TW.BIG5 BIG5"
266	echo "zh_TW.Big5 BIG5"
267	echo "zh_CN.EUC GB2312"
268	echo "ja_JP.EUC EUC-JP"
269	echo "ja_JP.SJIS SHIFT_JIS"
270	echo "ja_JP.Shift_JIS SHIFT_JIS"
271	echo "ko_KR.EUC EUC-KR"
272	;;
273    beos*)
274	# BeOS has a single locale, and it has UTF-8 encoding.
275	echo "* UTF-8"
276	;;
277    msdosdjgpp*)
278	# DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
279	# localcharset.c falls back to using the full locale name
280	# from the environment variables.
281	echo "#"
282	echo "# The encodings given here may not all be correct."
283	echo "# If you find that the encoding given for your language and"
284	echo "# country is not the one your DOS machine actually uses, just"
285	echo "# correct it in this file, and send a mail to"
286	echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>"
287	echo "# and Bruno Haible <haible@clisp.cons.org>."
288	echo "#"
289	echo "C ASCII"
290	# ISO-8859-1 languages
291	echo "ca CP850"
292	echo "ca_ES CP850"
293	echo "da CP865"    # not CP850 ??
294	echo "da_DK CP865" # not CP850 ??
295	echo "de CP850"
296	echo "de_AT CP850"
297	echo "de_CH CP850"
298	echo "de_DE CP850"
299	echo "en CP850"
300	echo "en_AU CP850" # not CP437 ??
301	echo "en_CA CP850"
302	echo "en_GB CP850"
303	echo "en_NZ CP437"
304	echo "en_US CP437"
305	echo "en_ZA CP850" # not CP437 ??
306	echo "es CP850"
307	echo "es_AR CP850"
308	echo "es_BO CP850"
309	echo "es_CL CP850"
310	echo "es_CO CP850"
311	echo "es_CR CP850"
312	echo "es_CU CP850"
313	echo "es_DO CP850"
314	echo "es_EC CP850"
315	echo "es_ES CP850"
316	echo "es_GT CP850"
317	echo "es_HN CP850"
318	echo "es_MX CP850"
319	echo "es_NI CP850"
320	echo "es_PA CP850"
321	echo "es_PY CP850"
322	echo "es_PE CP850"
323	echo "es_SV CP850"
324	echo "es_UY CP850"
325	echo "es_VE CP850"
326	echo "et CP850"
327	echo "et_EE CP850"
328	echo "eu CP850"
329	echo "eu_ES CP850"
330	echo "fi CP850"
331	echo "fi_FI CP850"
332	echo "fr CP850"
333	echo "fr_BE CP850"
334	echo "fr_CA CP850"
335	echo "fr_CH CP850"
336	echo "fr_FR CP850"
337	echo "ga CP850"
338	echo "ga_IE CP850"
339	echo "gd CP850"
340	echo "gd_GB CP850"
341	echo "gl CP850"
342	echo "gl_ES CP850"
343	echo "id CP850"    # not CP437 ??
344	echo "id_ID CP850" # not CP437 ??
345	echo "is CP861"    # not CP850 ??
346	echo "is_IS CP861" # not CP850 ??
347	echo "it CP850"
348	echo "it_CH CP850"
349	echo "it_IT CP850"
350	echo "lt CP775"
351	echo "lt_LT CP775"
352	echo "lv CP775"
353	echo "lv_LV CP775"
354	echo "nb CP865"    # not CP850 ??
355	echo "nb_NO CP865" # not CP850 ??
356	echo "nl CP850"
357	echo "nl_BE CP850"
358	echo "nl_NL CP850"
359	echo "nn CP865"    # not CP850 ??
360	echo "nn_NO CP865" # not CP850 ??
361	echo "no CP865"    # not CP850 ??
362	echo "no_NO CP865" # not CP850 ??
363	echo "pt CP850"
364	echo "pt_BR CP850"
365	echo "pt_PT CP850"
366	echo "sv CP850"
367	echo "sv_SE CP850"
368	# ISO-8859-2 languages
369	echo "cs CP852"
370	echo "cs_CZ CP852"
371	echo "hr CP852"
372	echo "hr_HR CP852"
373	echo "hu CP852"
374	echo "hu_HU CP852"
375	echo "pl CP852"
376	echo "pl_PL CP852"
377	echo "ro CP852"
378	echo "ro_RO CP852"
379	echo "sk CP852"
380	echo "sk_SK CP852"
381	echo "sl CP852"
382	echo "sl_SI CP852"
383	echo "sq CP852"
384	echo "sq_AL CP852"
385	echo "sr CP852"    # CP852 or CP866 or CP855 ??
386	echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
387	# ISO-8859-3 languages
388	echo "mt CP850"
389	echo "mt_MT CP850"
390	# ISO-8859-5 languages
391	echo "be CP866"
392	echo "be_BE CP866"
393	echo "bg CP866"    # not CP855 ??
394	echo "bg_BG CP866" # not CP855 ??
395	echo "mk CP866"    # not CP855 ??
396	echo "mk_MK CP866" # not CP855 ??
397	echo "ru KOI8-R"    # not CP866 ??
398	echo "ru_RU KOI8-R" # not CP866 ??
399	# ISO-8859-6 languages
400	echo "ar CP864"
401	echo "ar_AE CP864"
402	echo "ar_DZ CP864"
403	echo "ar_EG CP864"
404	echo "ar_IQ CP864"
405	echo "ar_IR CP864"
406	echo "ar_JO CP864"
407	echo "ar_KW CP864"
408	echo "ar_MA CP864"
409	echo "ar_OM CP864"
410	echo "ar_QA CP864"
411	echo "ar_SA CP864"
412	echo "ar_SY CP864"
413	# ISO-8859-7 languages
414	echo "el CP869"
415	echo "el_GR CP869"
416	# ISO-8859-8 languages
417	echo "he CP862"
418	echo "he_IL CP862"
419	# ISO-8859-9 languages
420	echo "tr CP857"
421	echo "tr_TR CP857"
422	# Japanese
423	echo "ja CP932"
424	echo "ja_JP CP932"
425	# Chinese
426	echo "zh_CN GBK"
427	echo "zh_TW CP950" # not CP938 ??
428	# Korean
429	echo "kr CP949"    # not CP934 ??
430	echo "kr_KR CP949" # not CP934 ??
431	# Thai
432	echo "th CP874"
433	echo "th_TH CP874"
434	# Other
435	echo "eo CP850"
436	echo "eo_EO CP850"
437	;;
438esac
439