1 /* Copyright (C) 2000-2008 by George Williams */
2 /*
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are met:
5 
6  * Redistributions of source code must retain the above copyright notice, this
7  * list of conditions and the following disclaimer.
8 
9  * Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12 
13  * The name of the author may not be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15 
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 #ifndef _CHARSET_H
28 #define _CHARSET_H
29 /* ASCII is ISO 646, except the ISO version admits national alternatives */
30 enum encoding { e_usascii, e_iso646_no, e_iso646_se, e_iso8859_1,
31     e_iso8859_2, e_iso8859_3, e_iso8859_4, e_iso8859_5, e_iso8859_6,
32     e_iso8859_7, e_iso8859_8, e_iso8859_9, e_iso8859_10,
33     e_iso8859_11/* same as TIS */, e_iso8859_13, e_iso8859_14, e_iso8859_15,
34     e_koi8_r,	/* RFC 1489 */
35     e_jis201,	/* 8 bit, ascii & katakana */
36     e_win, e_mac,
37     e_user,
38 /* korean appears to fit into the jis/euc encoding schemes */
39 /* the difference between jis & jis2 is what the output encoding should be (presence of '(') */
40     e_jis, e_jis2, e_jiskorean, e_jisgb, e_sjis,	/* multi-byte */
41     e_euc, e_euckorean, e_eucgb,
42     e_wansung, e_johab,
43     e_big5,
44     e_big5hkscs,
45     e_unicode, e_unicode_backwards,			/* wide chars */
46     e_utf7, e_utf8,					/* unicode encodings */
47     e_ucs4,						/* 4 byte chars */
48     e_notrans,					/* _inch returns 16bits */
49     e_encodingmax, e_unknown=-1, e_first2byte=e_jis };
50 
51 enum charset { em_none = -1,
52     em_iso8859_1, em_iso8859_2, em_iso8859_3, em_iso8859_4, em_iso8859_5,
53     em_iso8859_6, em_iso8859_7, em_iso8859_8, em_iso8859_9, em_iso8859_10,
54     em_iso8859_11/* same as TIS */, em_iso8859_13, em_iso8859_14, em_iso8859_15,
55     em_koi8_r,
56     em_jis201,
57     em_win, em_mac, em_symbol, em_zapfding, em_user, em_adobestandard=em_user,
58     em_jis208, em_jis212, em_ksc5601, em_gb2312, em_big5, em_big5hkscs,
59     em_johab /* Korean*/,
60 /* 28 */
61     em_unicode, em_unicode4, em_gb18030 , em_max, em_first2byte=em_jis208, em_last94x94=em_gb2312 };
62 
63 #if HAVE_ICONV_H
64 # include <iconv.h>
65 extern char *iconv_local_encoding_name;
66 #else
67 # include "gwwiconv.h"		/* My fake iconv based on encodings in gdraw/gunicode */
68 #endif
69 extern struct namemap { char *name; int map; } encodingnames[];
70 #endif
71