xref: /dflybsd-src/contrib/grep/lib/localcharset.h (revision 91b9ed38d3db6a8a8ac5b66da1d43e6e331e259a)
195b7b453SJohn Marino /* Determine a canonical name for the current locale's character encoding.
2*09d4459fSDaniel Fojt    Copyright (C) 2000-2003, 2009-2020 Free Software Foundation, Inc.
395b7b453SJohn Marino    This file is part of the GNU CHARSET Library.
495b7b453SJohn Marino 
595b7b453SJohn Marino    This program is free software; you can redistribute it and/or modify
695b7b453SJohn Marino    it under the terms of the GNU General Public License as published by
795b7b453SJohn Marino    the Free Software Foundation; either version 3, or (at your option)
895b7b453SJohn Marino    any later version.
995b7b453SJohn Marino 
1095b7b453SJohn Marino    This program is distributed in the hope that it will be useful,
1195b7b453SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
1295b7b453SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1395b7b453SJohn Marino    GNU General Public License for more details.
1495b7b453SJohn Marino 
1595b7b453SJohn Marino    You should have received a copy of the GNU General Public License along
16*09d4459fSDaniel Fojt    with this program; if not, see <https://www.gnu.org/licenses/>.  */
1795b7b453SJohn Marino 
1895b7b453SJohn Marino #ifndef _LOCALCHARSET_H
1995b7b453SJohn Marino #define _LOCALCHARSET_H
2095b7b453SJohn Marino 
2195b7b453SJohn Marino 
2295b7b453SJohn Marino #ifdef __cplusplus
2395b7b453SJohn Marino extern "C" {
2495b7b453SJohn Marino #endif
2595b7b453SJohn Marino 
2695b7b453SJohn Marino 
2795b7b453SJohn Marino /* Determine the current locale's character encoding, and canonicalize it
28*09d4459fSDaniel Fojt    into one of the canonical names listed below.
29*09d4459fSDaniel Fojt    The result must not be freed; it is statically allocated.  The result
30*09d4459fSDaniel Fojt    becomes invalid when setlocale() is used to change the global locale, or
31*09d4459fSDaniel Fojt    when the value of one of the environment variables LC_ALL, LC_CTYPE, LANG
32*09d4459fSDaniel Fojt    is changed; threads in multithreaded programs should not do this.
3395b7b453SJohn Marino    If the canonical name cannot be determined, the result is a non-canonical
3495b7b453SJohn Marino    name.  */
3595b7b453SJohn Marino extern const char * locale_charset (void);
3695b7b453SJohn Marino 
37*09d4459fSDaniel Fojt /* About GNU canonical names for character encodings:
38*09d4459fSDaniel Fojt 
39*09d4459fSDaniel Fojt    Every canonical name must be supported by GNU libiconv.  Support by GNU libc
40*09d4459fSDaniel Fojt    is also desirable.
41*09d4459fSDaniel Fojt 
42*09d4459fSDaniel Fojt    The name is case insensitive.  Usually an upper case MIME charset name is
43*09d4459fSDaniel Fojt    preferred.
44*09d4459fSDaniel Fojt 
45*09d4459fSDaniel Fojt    The current list of these GNU canonical names is:
46*09d4459fSDaniel Fojt 
47*09d4459fSDaniel Fojt        name              MIME?             used by which systems
48*09d4459fSDaniel Fojt                                     (darwin = Mac OS X, windows = native Windows)
49*09d4459fSDaniel Fojt 
50*09d4459fSDaniel Fojt    ASCII, ANSI_X3.4-1968       glibc solaris freebsd netbsd darwin minix cygwin
51*09d4459fSDaniel Fojt    ISO-8859-1              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
52*09d4459fSDaniel Fojt    ISO-8859-2              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
53*09d4459fSDaniel Fojt    ISO-8859-3              Y   glibc solaris cygwin
54*09d4459fSDaniel Fojt    ISO-8859-4              Y   hpux osf solaris freebsd netbsd openbsd darwin
55*09d4459fSDaniel Fojt    ISO-8859-5              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
56*09d4459fSDaniel Fojt    ISO-8859-6              Y   glibc aix hpux solaris cygwin
57*09d4459fSDaniel Fojt    ISO-8859-7              Y   glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
58*09d4459fSDaniel Fojt    ISO-8859-8              Y   glibc aix hpux osf solaris cygwin zos
59*09d4459fSDaniel Fojt    ISO-8859-9              Y   glibc aix hpux irix osf solaris freebsd darwin cygwin zos
60*09d4459fSDaniel Fojt    ISO-8859-13                 glibc hpux solaris freebsd netbsd openbsd darwin cygwin
61*09d4459fSDaniel Fojt    ISO-8859-14                 glibc cygwin
62*09d4459fSDaniel Fojt    ISO-8859-15                 glibc aix irix osf solaris freebsd netbsd openbsd darwin cygwin
63*09d4459fSDaniel Fojt    KOI8-R                  Y   glibc hpux solaris freebsd netbsd openbsd darwin
64*09d4459fSDaniel Fojt    KOI8-U                  Y   glibc freebsd netbsd openbsd darwin cygwin
65*09d4459fSDaniel Fojt    KOI8-T                      glibc
66*09d4459fSDaniel Fojt    CP437                       dos
67*09d4459fSDaniel Fojt    CP775                       dos
68*09d4459fSDaniel Fojt    CP850                       aix osf dos
69*09d4459fSDaniel Fojt    CP852                       dos
70*09d4459fSDaniel Fojt    CP855                       dos
71*09d4459fSDaniel Fojt    CP856                       aix
72*09d4459fSDaniel Fojt    CP857                       dos
73*09d4459fSDaniel Fojt    CP861                       dos
74*09d4459fSDaniel Fojt    CP862                       dos
75*09d4459fSDaniel Fojt    CP864                       dos
76*09d4459fSDaniel Fojt    CP865                       dos
77*09d4459fSDaniel Fojt    CP866                       freebsd netbsd openbsd darwin dos
78*09d4459fSDaniel Fojt    CP869                       dos
79*09d4459fSDaniel Fojt    CP874                       windows dos
80*09d4459fSDaniel Fojt    CP922                       aix
81*09d4459fSDaniel Fojt    CP932                       aix cygwin windows dos
82*09d4459fSDaniel Fojt    CP943                       aix zos
83*09d4459fSDaniel Fojt    CP949                       osf darwin windows dos
84*09d4459fSDaniel Fojt    CP950                       windows dos
85*09d4459fSDaniel Fojt    CP1046                      aix
86*09d4459fSDaniel Fojt    CP1124                      aix
87*09d4459fSDaniel Fojt    CP1125                      dos
88*09d4459fSDaniel Fojt    CP1129                      aix
89*09d4459fSDaniel Fojt    CP1131                      freebsd darwin
90*09d4459fSDaniel Fojt    CP1250                      windows
91*09d4459fSDaniel Fojt    CP1251                      glibc hpux solaris freebsd netbsd openbsd darwin cygwin windows
92*09d4459fSDaniel Fojt    CP1252                      aix windows
93*09d4459fSDaniel Fojt    CP1253                      windows
94*09d4459fSDaniel Fojt    CP1254                      windows
95*09d4459fSDaniel Fojt    CP1255                      glibc windows
96*09d4459fSDaniel Fojt    CP1256                      windows
97*09d4459fSDaniel Fojt    CP1257                      windows
98*09d4459fSDaniel Fojt    GB2312                  Y   glibc aix hpux irix solaris freebsd netbsd darwin cygwin zos
99*09d4459fSDaniel Fojt    EUC-JP                  Y   glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin
100*09d4459fSDaniel Fojt    EUC-KR                  Y   glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin zos
101*09d4459fSDaniel Fojt    EUC-TW                      glibc aix hpux irix osf solaris netbsd
102*09d4459fSDaniel Fojt    BIG5                    Y   glibc aix hpux osf solaris freebsd netbsd darwin cygwin zos
103*09d4459fSDaniel Fojt    BIG5-HKSCS                  glibc hpux solaris netbsd darwin
104*09d4459fSDaniel Fojt    GBK                         glibc aix osf solaris freebsd darwin cygwin windows dos
105*09d4459fSDaniel Fojt    GB18030                     glibc hpux solaris freebsd netbsd darwin
106*09d4459fSDaniel Fojt    SHIFT_JIS               Y   hpux osf solaris freebsd netbsd darwin
107*09d4459fSDaniel Fojt    JOHAB                       glibc solaris windows
108*09d4459fSDaniel Fojt    TIS-620                     glibc aix hpux osf solaris cygwin zos
109*09d4459fSDaniel Fojt    VISCII                  Y   glibc
110*09d4459fSDaniel Fojt    TCVN5712-1                  glibc
111*09d4459fSDaniel Fojt    ARMSCII-8                   glibc freebsd netbsd darwin
112*09d4459fSDaniel Fojt    GEORGIAN-PS                 glibc cygwin
113*09d4459fSDaniel Fojt    PT154                       glibc netbsd cygwin
114*09d4459fSDaniel Fojt    HP-ROMAN8                   hpux
115*09d4459fSDaniel Fojt    HP-ARABIC8                  hpux
116*09d4459fSDaniel Fojt    HP-GREEK8                   hpux
117*09d4459fSDaniel Fojt    HP-HEBREW8                  hpux
118*09d4459fSDaniel Fojt    HP-TURKISH8                 hpux
119*09d4459fSDaniel Fojt    HP-KANA8                    hpux
120*09d4459fSDaniel Fojt    DEC-KANJI                   osf
121*09d4459fSDaniel Fojt    DEC-HANYU                   osf
122*09d4459fSDaniel Fojt    UTF-8                   Y   glibc aix hpux osf solaris netbsd darwin cygwin zos
123*09d4459fSDaniel Fojt 
124*09d4459fSDaniel Fojt    Note: Names which are not marked as being a MIME name should not be used in
125*09d4459fSDaniel Fojt    Internet protocols for information interchange (mail, news, etc.).
126*09d4459fSDaniel Fojt 
127*09d4459fSDaniel Fojt    Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names.  Applications
128*09d4459fSDaniel Fojt    must understand both names and treat them as equivalent.
129*09d4459fSDaniel Fojt  */
130*09d4459fSDaniel Fojt 
13195b7b453SJohn Marino 
13295b7b453SJohn Marino #ifdef __cplusplus
13395b7b453SJohn Marino }
13495b7b453SJohn Marino #endif
13595b7b453SJohn Marino 
13695b7b453SJohn Marino 
13795b7b453SJohn Marino #endif /* _LOCALCHARSET_H */
138