1CHARSETS(7)                Linux Programmer's Manual               CHARSETS(7)
2
3
4

NAME

6       charsets - programmer's view of character sets and internationalization
7

DESCRIPTION

9       Linux  is  an international operating system.  Various of its utilities
10       and device drivers (including the console driver) support  multilingual
11       character sets including Latin-alphabet letters with diacritical marks,
12       accents, ligatures, and entire  non-Latin  alphabets  including  Greek,
13       Cyrillic, Arabic, and Hebrew.
14
15       This  manual page presents a programmer's-eye view of different charac‐
16       ter-set standards and how they fit together on Linux.   Standards  dis‐
17       cussed include ASCII, ISO 8859, KOI8-R, Unicode, ISO 2022 and ISO 4873.
18       The primary emphasis is on character sets actually used as locale char‐
19       acter  sets, not the myriad others that can be found in data from other
20       systems.
21
22       A complete list of charsets used in an officially supported  locale  in
23       glibc   2.2.3   is:  ISO-8859-{1,2,3,5,6,7,8,9,13,15},  CP1251,  UTF-8,
24       EUC-{KR,JP,TW}, KOI8-{R,U}, GB2312, GB18030, GBK, BIG5, BIG5-HKSCS  and
25       TIS-620  (in  no  particular  order.)   (Romanian  may  be switching to
26       ISO-8859-16.)
27
28   ASCII
29       ASCII (American Standard Code For Information Interchange) is the orig‐
30       inal 7-bit character set, originally designed for American English.  It
31       is currently described by the ECMA-6 standard.
32
33       Various ASCII variants replacing the dollar sign  with  other  currency
34       symbols  and  replacing punctuation with non-English alphabetic charac‐
35       ters to cover German, French, Spanish and others in 7 bits exist.   All
36       are  deprecated;  glibc  doesn't  support  locales whose character sets
37       aren't true supersets of ASCII.  (These sets are also known as ISO-646,
38       a close relative of ASCII that permitted replacing these characters.)
39
40       As  Linux was written for hardware designed in the US, it natively sup‐
41       ports ASCII.
42
43   ISO 8859
44       ISO 8859 is a series of 15 8-bit character sets all of  which  have  US
45       ASCII  in their low (7-bit) half, invisible control characters in posi‐
46       tions 128 to 159, and 96 fixed-width graphics in positions 160-255.
47
48       Of these, the most important is ISO 8859-1 (Latin-1).  It  is  natively
49       supported  in the Linux console driver, fairly well supported in X11R6,
50       and is the base character set of HTML.
51
52       Console support for the other 8859 character sets  is  available  under
53       Linux through user-mode utilities (such as setfont(8)) that modify key‐
54       board bindings and the EGA graphics table and employ the "user mapping"
55       font table in the console driver.
56
57       Here are brief descriptions of each set:
58
59       8859-1 (Latin-1)
60              Latin-1 covers most Western European languages such as Albanian,
61              Catalan, Danish, Dutch, English, Faroese, Finnish, French,  Ger‐
62              man, Galician, Irish, Icelandic, Italian, Norwegian, Portuguese,
63              Spanish, and Swedish.  The  lack  of  the  ligatures  Dutch  ij,
64              French oe and old-style ,,German`` quotation marks is considered
65              tolerable.
66
67       8859-2 (Latin-2)
68              Latin-2 supports most Latin-written Slavic and Central  European
69              languages: Croatian, Czech, German, Hungarian, Polish, Rumanian,
70              Slovak, and Slovene.
71
72       8859-3 (Latin-3)
73              Latin-3 is popular with authors of Esperanto, Galician, and Mal‐
74              tese.  (Turkish is now written with 8859-9 instead.)
75
76       8859-4 (Latin-4)
77              Latin-4  introduced  letters  for Estonian, Latvian, and Lithua‐
78              nian.  It is essentially obsolete;  see  8859-10  (Latin-6)  and
79              8859-13 (Latin-7).
80
81       8859-5 Cyrillic letters supporting Bulgarian, Byelorussian, Macedonian,
82              Russian, Serbian and  Ukrainian.   Ukrainians  read  the  letter
83              "ghe"  with  downstroke  as  "heh"  and  would  need  a ghe with
84              upstroke to write a correct ghe.  See the discussion  of  KOI8-R
85              below.
86
87       8859-6 Supports Arabic.  The 8859-6 glyph table is a fixed font of sep‐
88              arate letter forms, but a proper display engine  should  combine
89              these using the proper initial, medial, and final forms.
90
91       8859-7 Supports Modern Greek.
92
93       8859-8 Supports modern Hebrew without niqud (punctuation signs).  Niqud
94              and full-fledged Biblical Hebrew are outside the scope  of  this
95              character  set; under Linux, UTF-8 is the preferred encoding for
96              these.
97
98       8859-9 (Latin-5)
99              This is a variant of Latin-1  that  replaces  Icelandic  letters
100              with Turkish ones.
101
102       8859-10 (Latin-6)
103              Latin  6  adds  the  last Inuit (Greenlandic) and Sami (Lappish)
104              letters that were missing in Latin 4 to cover the entire  Nordic
105              area.   RFC  1345  listed  a preliminary and different "latin6".
106              Skolt Sami still needs a few more accents than these.
107
108       8859-11
109              This only exists as a rejected draft standard.  The draft  stan‐
110              dard  was  identical  to  TIS-620, which is used under Linux for
111              Thai.
112
113       8859-12
114              This set does not exist.  While Vietnamese  has  been  suggested
115              for  this  space,  it  does not fit within the 96 (noncombining)
116              characters ISO 8859 offers.  UTF-8 is  the  preferred  character
117              set for Vietnamese use under Linux.
118
119       8859-13 (Latin-7)
120              Supports  the  Baltic  Rim languages; in particular, it includes
121              Latvian characters not found in Latin-4.
122
123       8859-14 (Latin-8)
124              This is the Celtic character set,  covering  Gaelic  and  Welsh.
125              This  charset also contains the dotted characters needed for Old
126              Irish.
127
128       8859-15 (Latin-9)
129              This adds the Euro sign and French and Finnish letters that were
130              missing in Latin-1.
131
132       8859-16 (Latin-10)
133              This  set  covers  many  of the languages covered by 8859-2, and
134              supports Romanian more completely then that set does.
135
136   KOI8-R
137       KOI8-R is a non-ISO character set popular in Russia.  The lower half is
138       US  ASCII;  the  upper  is  a  Cyrillic  character  set somewhat better
139       designed than ISO 8859-5.  KOI8-U is a common character set, based  off
140       KOI8-R,  that  has better support for Ukrainian.  Neither of these sets
141       are ISO-2022 compatible, unlike the ISO-8859 series.
142
143       Console support for KOI8-R is available under Linux  through  user-mode
144       utilities that modify keyboard bindings and the EGA graphics table, and
145       employ the "user mapping" font table in the console driver.
146
147   JIS X 0208
148       JIS X 0208 is a Japanese national standard character set.  Though there
149       are  some  more  Japanese  national standard character sets (like JIS X
150       0201, JIS X 0212, and JIS X 0213), this  is  the  most  important  one.
151       Characters  are mapped into a 94x94 two-byte matrix, whose each byte is
152       in the range 0x21-0x7e.  Note that JIS X 0208 is a character  set,  not
153       an  encoding.   This  means  that  JIS  X  0208  itself is not used for
154       expressing text data.  JIS X 0208 is used as a component  to  construct
155       encodings  such  as  EUC-JP, Shift_JIS, and ISO-2022-JP.  EUC-JP is the
156       most important encoding for Linux and includes US ASCII and JIS X 0208.
157       In  EUC-JP,  JIS  X 0208 characters are expressed in two bytes, each of
158       which is the JIS X 0208 code plus 0x80.
159
160   KS X 1001
161       KS X 1001 is a Korean national standard character set.  Just as  JIS  X
162       0208, characters are mapped into a 94x94 two-byte matrix.  KS X 1001 is
163       used like JIS X 0208, as a component to  construct  encodings  such  as
164       EUC-KR,  Johab, and ISO-2022-KR.  EUC-KR is the most important encoding
165       for Linux and includes US ASCII and KS X 1001.  KS C 5601 is  an  older
166       name for KS X 1001.
167
168   GB 2312
169       GB  2312  is a mainland Chinese national standard character set used to
170       express simplified Chinese.  Just  like  JIS  X  0208,  characters  are
171       mapped  into  a 94x94 two-byte matrix used to construct EUC-CN.  EUC-CN
172       is the most important encoding for Linux and includes US ASCII  and  GB
173       2312.  Note that EUC-CN is often called as GB, GB 2312, or CN-GB.
174
175   Big5
176       Big5  is  a popular character set in Taiwan to express traditional Chi‐
177       nese.  (Big5 is both a character set and an encoding.)  It is a  super‐
178       set  of  US  ASCII.   Non-ASCII  characters are expressed in two bytes.
179       Bytes 0xa1-0xfe are used as  leading  bytes  for  two-byte  characters.
180       Big5  and  its extension is widely used in Taiwan and Hong Kong.  It is
181       not ISO 2022-compliant.
182
183   TIS 620
184       TIS 620 is a Thai national standard character set and a superset of  US
185       ASCII.    Like  ISO  8859  series,  Thai  characters  are  mapped  into
186       0xa1-0xfe.  TIS 620 is the only commonly used character set under Linux
187       besides UTF-8 to have combining characters.
188
189   UNICODE
190       Unicode (ISO 10646) is a standard which aims to unambiguously represent
191       every character in every human language.  Unicode's  structure  permits
192       20.1  bits  to  encode  every  character.   Since  most computers don't
193       include 20.1-bit integers, Unicode is usually encoded as  32-bit  inte‐
194       gers  internally and either a series of 16-bit integers (UTF-16) (need‐
195       ing two 16-bit integers only when encoding certain rare characters)  or
196       a  series  of 8-bit bytes (UTF-8).  Information on Unicode is available
197       at <http://www.unicode.org>.
198
199       Linux represents Unicode using the 8-bit Unicode Transformation  Format
200       (UTF-8).   UTF-8  is  a variable length encoding of Unicode.  It uses 1
201       byte to code 7 bits, 2 bytes for 11 bits, 3 bytes for 16 bits, 4  bytes
202       for 21 bits, 5 bytes for 26 bits, 6 bytes for 31 bits.
203
204       Let  0,1,x  stand  for  a zero, one, or arbitrary bit.  A byte 0xxxxxxx
205       stands for the Unicode 00000000 0xxxxxxx which codes the same symbol as
206       the  ASCII 0xxxxxxx.  Thus, ASCII goes unchanged into UTF-8, and people
207       using only ASCII do not notice any change: not in code, and not in file
208       size.
209
210       A byte 110xxxxx is the start of a 2-byte code, and 110xxxxx 10yyyyyy is
211       assembled into 00000xxx xxyyyyyy.  A byte 1110xxxx is the  start  of  a
212       3-byte  code, and 1110xxxx 10yyyyyy 10zzzzzz is assembled into xxxxyyyy
213       yyzzzzzz.  (When UTF-8 is used to code the 31-bit ISO 10646  then  this
214       progression continues up to 6-byte codes.)
215
216       For  most  people  who use ISO-8859 character sets, this means that the
217       characters outside of ASCII are now coded with two bytes.   This  tends
218       to  expand ordinary text files by only one or two percent.  For Russian
219       or Greek users, this expands ordinary text files by 100%, since text in
220       those  languages  is  mostly outside of ASCII.  For Japanese users this
221       means that the 16-bit codes now in common use will  take  three  bytes.
222       While  there are algorithmic conversions from some character sets (esp.
223       ISO-8859-1) to Unicode, general  conversion  requires  carrying  around
224       conversion tables, which can be quite large for 16-bit codes.
225
226       Note  that  UTF-8  is self-synchronizing: 10xxxxxx is a tail, any other
227       byte is the head of a code.  Note that the only way ASCII  bytes  occur
228       in  a  UTF-8  stream,  is  as  themselves.  In particular, there are no
229       embedded NULs ('\0') or '/'s that form part of some larger code.
230
231       Since ASCII, and, in particular, NUL and '/', are unchanged, the kernel
232       does not notice that UTF-8 is being used.  It does not care at all what
233       the bytes it is handling stand for.
234
235       Rendering of Unicode data streams is typically  handled  through  "sub‐
236       font"  tables  which map a subset of Unicode to glyphs.  Internally the
237       kernel uses Unicode to describe the subfont loaded in video RAM.   This
238       means that in UTF-8 mode one can use a character set with 512 different
239       symbols.  This is not enough for Japanese, Chinese and Korean,  but  it
240       is enough for most other purposes.
241
242       At the current time, the console driver does not handle combining char‐
243       acters.  So Thai, Sioux and any other script needing combining  charac‐
244       ters can't be handled on the console.
245
246   ISO 2022 and ISO 4873
247       The  ISO 2022 and 4873 standards describe a font-control model based on
248       VT100 practice.  This model is (partially) supported by the Linux  ker‐
249       nel and by xterm(1).  It is popular in Japan and Korea.
250
251       There  are  4 graphic character sets, called G0, G1, G2 and G3, and one
252       of them is the current character set for codes with high bit zero (ini‐
253       tially G0), and one of them is the current character set for codes with
254       high bit one (initially G1).  Each graphic character set has 94  or  96
255       characters,  and  is  essentially a 7-bit character set.  It uses codes
256       either 040-0177 (041-0176) or 0240-0377  (0241-0376).   G0  always  has
257       size 94 and uses codes 041-0176.
258
259       Switching  between  character sets is done using the shift functions ^N
260       (SO or LS1), ^O (SI or LS0), ESC n (LS2), ESC o (LS3), ESC N (SS2), ESC
261       O  (SS3),  ESC  ~ (LS1R), ESC } (LS2R), ESC | (LS3R).  The function LSn
262       makes character set Gn the current one for codes with  high  bit  zero.
263       The function LSnR makes character set Gn the current one for codes with
264       high bit one.  The function SSn makes character set Gn (n=2 or  3)  the
265       current one for the next character only (regardless of the value of its
266       high order bit).
267
268       A 94-character set is designated as  Gn  character  set  by  an  escape
269       sequence ESC ( xx (for G0), ESC ) xx (for G1), ESC * xx (for G2), ESC +
270       xx (for G3), where xx is a symbol or a pair of symbols found in the ISO
271       2375  International Register of Coded Character Sets.  For example, ESC
272       ( @ selects the ISO 646 character set as G0, ESC (  A  selects  the  UK
273       standard  character  set  (with  pound instead of number sign), ESC ( B
274       selects ASCII (with dollar instead of currency sign), ESC ( M selects a
275       character  set for African languages, ESC ( ! A selects the Cuban char‐
276       acter set, etc. etc.
277
278       A 96-character set is designated as  Gn  character  set  by  an  escape
279       sequence  ESC  -  xx  (for G1), ESC . xx (for G2) or ESC / xx (for G3).
280       For example, ESC - G selects the Hebrew alphabet as G1.
281
282       A multibyte character set is designated  as  Gn  character  set  by  an
283       escape  sequence  ESC $ xx or ESC $ ( xx (for G0), ESC $ ) xx (for G1),
284       ESC $ * xx (for G2), ESC $ + xx (for G3).   For  example,  ESC  $  (  C
285       selects  the  Korean  character set for G0.  The Japanese character set
286       selected by ESC $ B has a more recent version selected by ESC & @ ESC $
287       B.
288
289       ISO 4873 stipulates a narrower use of character sets, where G0 is fixed
290       (always ASCII), so that G1, G2 and G3 can only  be  invoked  for  codes
291       with  the  high  order  bit set.  In particular, ^N and ^O are not used
292       anymore, ESC ( xx can be used only with xx=B, and ESC ) xx, ESC  *  xx,
293       ESC + xx are equivalent to ESC - xx, ESC . xx, ESC / xx, respectively.
294

SEE ALSO

296       console(4),      console_codes(4),      console_ioctl(4),     ascii(7),
297       iso_8859-1(7), unicode(7), utf-8(7)
298

COLOPHON

300       This page is part of release 3.25 of the Linux  man-pages  project.   A
301       description  of  the project, and information about reporting bugs, can
302       be found at http://www.kernel.org/doc/man-pages/.
303
304
305
306Linux                             2008-06-03                       CHARSETS(7)
Impressum