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

NAME

6       charsets - character set standards and internationalization
7

DESCRIPTION

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

SEE ALSO

278       iconv(1), ascii(7), iso_8859-1(7), unicode(7), utf-8(7)
279

COLOPHON

281       This  page  is  part of release 4.15 of the Linux man-pages project.  A
282       description of the project, information about reporting bugs,  and  the
283       latest     version     of     this    page,    can    be    found    at
284       https://www.kernel.org/doc/man-pages/.
285
286
287
288Linux                             2017-09-15                       CHARSETS(7)
Impressum