OSDN Git Service

(split) LDP: Update original to LDP v3.51.
[linuxjm/LDP_man-pages.git] / original / man7 / unicode.7
1 .\" Copyright (C) Markus Kuhn, 1995, 2001
2 .\"
3 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
8 .\"
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
13 .\"
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 .\" GNU General Public License for more details.
18 .\"
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, see
21 .\" <http://www.gnu.org/licenses/>.
22 .\" %%%LICENSE_END
23 .\"
24 .\" 1995-11-26  Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
25 .\"      First version written
26 .\" 2001-05-11  Markus Kuhn <mgk25@cl.cam.ac.uk>
27 .\"      Update
28 .\"
29 .TH UNICODE 7 2012-08-05 "GNU" "Linux Programmer's Manual"
30 .SH NAME
31 Unicode \- universal character set
32 .SH DESCRIPTION
33 The international standard
34 .B ISO 10646
35 defines the
36 .BR "Universal Character Set (UCS)" .
37 UCS contains all characters of all other character set standards.
38 It also guarantees
39 .BR "round-trip compatibility" ,
40 i.e., conversion tables can be built such that no information is lost
41 when a string is converted from any other encoding to UCS and back.
42
43 UCS contains the characters required to represent practically all
44 known languages.
45 This includes not only the Latin, Greek, Cyrillic,
46 Hebrew, Arabic, Armenian, and Georgian scripts, but also Chinese,
47 Japanese and Korean Han ideographs as well as scripts such as
48 Hiragana, Katakana, Hangul, Devanagari, Bengali, Gurmukhi, Gujarati,
49 Oriya, Tamil, Telugu, Kannada, Malayalam, Thai, Lao, Khmer, Bopomofo,
50 Tibetan, Runic, Ethiopic, Canadian Syllabics, Cherokee, Mongolian,
51 Ogham, Myanmar, Sinhala, Thaana, Yi, and others.
52 For scripts not yet
53 covered, research on how to best encode them for computer usage is
54 still going on and they will be added eventually.
55 This might
56 eventually include not only Hieroglyphs and various historic
57 Indo-European languages, but even some selected artistic scripts such
58 as Tengwar, Cirth, and Klingon.
59 UCS also covers a large number of
60 graphical, typographical, mathematical and scientific symbols,
61 including those provided by TeX, Postscript, APL, MS-DOS, MS-Windows,
62 Macintosh, OCR fonts, as well as many word processing and publishing
63 systems, and more are being added.
64
65 The UCS standard (ISO 10646) describes a
66 .I "31-bit character set architecture"
67 consisting of 128 24-bit
68 .IR groups ,
69 each divided into 256 16-bit
70 .I planes
71 made up of 256 8-bit
72 .I rows
73 with 256
74 .I column
75 positions, one for each character.
76 Part 1 of the standard
77 .RB ( "ISO 10646-1" )
78 defines the first 65534 code positions (0x0000 to 0xfffd), which form
79 the
80 .IR "Basic Multilingual Plane (BMP)" ,
81 that is plane 0 in group 0.
82 Part 2 of the standard
83 .RB ( "ISO 10646-2" )
84 adds characters to group 0 outside the BMP in several
85 .I "supplementary planes"
86 in the range 0x10000 to 0x10ffff.
87 There are no plans to add characters
88 beyond 0x10ffff to the standard, therefore of the entire code space,
89 only a small fraction of group 0 will ever be actually used in the
90 foreseeable future.
91 The BMP contains all characters found in the
92 commonly used other character sets.
93 The supplemental planes added by
94 ISO 10646-2 cover only more exotic characters for special scientific,
95 dictionary printing, publishing industry, higher-level protocol and
96 enthusiast needs.
97 .PP
98 The representation of each UCS character as a 2-byte word is referred
99 to as the
100 .B UCS-2
101 form (only for BMP characters), whereas
102 .B UCS-4
103 is the representation of each character by a 4-byte word.
104 In addition, there exist two encoding forms
105 .B UTF-8
106 for backward compatibility with ASCII processing software and
107 .B UTF-16
108 for the backward-compatible handling of non-BMP characters up to
109 0x10ffff by UCS-2 software.
110 .PP
111 The UCS characters 0x0000 to 0x007f are identical to those of the
112 classic
113 .B US-ASCII
114 character set and the characters in the range 0x0000 to 0x00ff
115 are identical to those in
116 .BR "ISO 8859-1 Latin-1" .
117 .SS Combining characters
118 Some code points in
119 .B UCS
120 have been assigned to
121 .IR "combining characters" .
122 These are similar to the nonspacing accent keys on a typewriter.
123 A combining character just adds an accent to the previous character.
124 The most important accented characters have codes of their own in UCS,
125 however, the combining character mechanism allows us to add accents
126 and other diacritical marks to any character.
127 The combining characters
128 always follow the character which they modify.
129 For example, the German
130 character Umlaut-A ("Latin capital letter A with diaeresis") can
131 either be represented by the precomposed UCS code 0x00c4, or
132 alternatively as the combination of a normal "Latin capital letter A"
133 followed by a "combining diaeresis": 0x0041 0x0308.
134 .PP
135 Combining characters are essential for instance for encoding the Thai
136 script or for mathematical typesetting and users of the International
137 Phonetic Alphabet.
138 .SS Implementation levels
139 As not all systems are expected to support advanced mechanisms like
140 combining characters, ISO 10646-1 specifies the following three
141 .I implementation levels
142 of UCS:
143 .TP 0.9i
144 Level 1
145 Combining characters and
146 .B Hangul Jamo
147 (a variant encoding of the Korean script, where a Hangul syllable
148 glyph is coded as a triplet or pair of vovel/consonant codes) are not
149 supported.
150 .TP
151 Level 2
152 In addition to level 1, combining characters are now allowed for some
153 languages where they are essential (e.g., Thai, Lao, Hebrew,
154 Arabic, Devanagari, Malayalam).
155 .TP
156 Level 3
157 All
158 .B UCS
159 characters are supported.
160 .PP
161 The
162 .B Unicode 3.0 Standard
163 published by the
164 .B Unicode Consortium
165 contains exactly the
166 .B UCS Basic Multilingual Plane
167 at implementation level 3, as described in ISO 10646-1:2000.
168 .B Unicode 3.1
169 added the supplemental planes of ISO 10646-2.
170 The Unicode standard and
171 technical reports published by the Unicode Consortium provide much
172 additional information on the semantics and recommended usages of
173 various characters.
174 They provide guidelines and algorithms for
175 editing, sorting, comparing, normalizing, converting and displaying
176 Unicode strings.
177 .SS Unicode under Linux
178 Under GNU/Linux, the C type
179 .I wchar_t
180 is a signed 32-bit integer type.
181 Its values are always interpreted
182 by the C library as
183 .B UCS
184 code values (in all locales), a convention that is signaled by the GNU
185 C library to applications by defining the constant
186 .B __STDC_ISO_10646__
187 as specified in the ISO C99 standard.
188
189 UCS/Unicode can be used just like ASCII in input/output streams,
190 terminal communication, plaintext files, filenames, and environment
191 variables in the ASCII compatible
192 .B UTF-8
193 multibyte encoding.
194 To signal the use of UTF-8 as the character
195 encoding to all applications, a suitable
196 .I locale
197 has to be selected via environment variables (e.g.,
198 "LANG=en_GB.UTF-8").
199 .PP
200 The
201 .B nl_langinfo(CODESET)
202 function returns the name of the selected encoding.
203 Library functions such as
204 .BR wctomb (3)
205 and
206 .BR mbsrtowcs (3)
207 can be used to transform the internal
208 .I wchar_t
209 characters and strings into the system character encoding and back
210 and
211 .BR wcwidth (3)
212 tells, how many positions (0\(en2) the cursor is advanced by the
213 output of a character.
214 .PP
215 Under Linux, in general only the BMP at implementation level 1 should
216 be used at the moment.
217 Up to two combining characters per base
218 character for certain scripts (in particular Thai) are also supported
219 by some UTF-8 terminal emulators and ISO 10646 fonts (level 2), but in
220 general precomposed characters should be preferred where available
221 (Unicode calls this
222 .BR "Normalization Form C" ).
223 .SS Private area
224 In the
225 .BR BMP ,
226 the range 0xe000 to 0xf8ff will never be assigned to any characters by
227 the standard and is reserved for private usage.
228 For the Linux
229 community, this private area has been subdivided further into the
230 range 0xe000 to 0xefff which can be used individually by any end-user
231 and the Linux zone in the range 0xf000 to 0xf8ff where extensions are
232 coordinated among all Linux users.
233 The registry of the characters
234 assigned to the Linux zone is currently maintained by H. Peter Anvin
235 <Peter.Anvin@linux.org>.
236 .SS Literature
237 .TP 0.2i
238 *
239 Information technology \(em Universal Multiple-Octet Coded Character
240 Set (UCS) \(em Part 1: Architecture and Basic Multilingual Plane.
241 International Standard ISO/IEC 10646-1, International Organization
242 for Standardization, Geneva, 2000.
243
244 This is the official specification of
245 .BR UCS .
246 Available as a PDF file on CD-ROM from
247 .UR http://www.iso.ch/
248 .UE .
249 .TP
250 *
251 The Unicode Standard, Version 3.0.
252 The Unicode Consortium, Addison-Wesley,
253 Reading, MA, 2000, ISBN 0-201-61633-5.
254 .TP
255 *
256 S. Harbison, G. Steele. C: A Reference Manual. Fourth edition,
257 Prentice Hall, Englewood Cliffs, 1995, ISBN 0-13-326224-3.
258
259 A good reference book about the C programming language.
260 The fourth
261 edition covers the 1994 Amendment 1 to the ISO C90 standard, which
262 adds a large number of new C library functions for handling wide and
263 multibyte character encodings, but it does not yet cover ISO C99,
264 which improved wide and multibyte character support even further.
265 .TP
266 *
267 Unicode Technical Reports.
268 .RS
269 .UR http://www.unicode.org\:/unicode\:/reports/
270 .UE
271 .RE
272 .TP
273 *
274 Markus Kuhn: UTF-8 and Unicode FAQ for UNIX/Linux.
275 .RS
276 .UR http://www.cl.cam.ac.uk\:/~mgk25\:/unicode.html
277 .UE
278
279 Provides subscription information for the
280 .I linux-utf8
281 mailing list, which is the best place to look for advice on using
282 Unicode under Linux.
283 .RE
284 .TP
285 *
286 Bruno Haible: Unicode HOWTO.
287 .RS
288 .UR ftp://ftp.ilog.fr\:/pub\:/Users\:/haible\:/utf8\:/Unicode-HOWTO.html
289 .UE
290 .RE
291 .SH BUGS
292 When this man page was last revised, the GNU C Library support for
293 .B UTF-8
294 locales was mature and XFree86 support was in an advanced state, but
295 work on making applications (most notably editors) suitable for use in
296 .B UTF-8
297 locales was still fully in progress.
298 Current general
299 .B UCS
300 support under Linux usually provides for CJK double-width characters
301 and sometimes even simple overstriking combining characters, but
302 usually does not include support for scripts with right-to-left
303 writing direction or ligature substitution requirements such as
304 Hebrew, Arabic, or the Indic scripts.
305 These scripts are currently
306 supported only in certain GUI applications (HTML viewers, word processors)
307 with sophisticated text rendering engines.
308 .\" .SH AUTHOR
309 .\" Markus Kuhn <mgk25@cl.cam.ac.uk>
310 .SH SEE ALSO
311 .BR setlocale (3),
312 .BR charsets (7),
313 .BR utf-8 (7)