--- charsets.7.orig	Mon May  7 01:35:08 2001
+++ charsets.7	Fri Aug  3 20:59:01 2001
@@ -7,9 +7,10 @@
 .\" the License, or (at your option) any later version.
 .\"
 .\" This is combined from many sources, including notes by aeb and
-.\" research by esr.  Portions derive from a writeup by Ramon Czybora.
+.\" research by esr.  Portions derive from a writeup by Roman Czyborra.
 .\"
-.TH CHARSETS 7 "November 5th, 1996" "Linux" "Linux Programmer's Manual"
+.\" Last changed by David Starner <dstarner98@aasaa.ofe.org>.
+.TH CHARSETS 7 "May 7, 2001" "Linux" "Linux Programmer's Manual"
 .SH NAME
 charsets \- programmer's view of character sets and internationalization
 .SH DESCRIPTION
@@ -22,23 +23,31 @@
 This manual page presents a programmer's-eye view of different
 character-set standards and how they fit together on Linux.  Standards
 discussed include ASCII, ISO 8859, KOI8-R, Unicode, ISO 2022 and
-ISO 4873.
+ISO 4873. The primary emphasis is on character sets actually used as
+locale character sets, not the myriad others that can be found in data
+from other systems.
+.LP
+A complete list of charsets used in a officially supported locale in glibc
+2.2.3 is: ISO-8859-{1,2,3,5,6,7,8,9,13,15}, CP1251, UTF-8, EUC-{KR,JP,TW},
+KOI8-{R,U}, GB2312, GB18030, GBK, BIG5, BIG5-HKSCS and TIS-620 (in no
+particular order.) (Romanian may be switching to ISO-8859-16.)
 
 .SH ASCII
 ASCII (American Standard Code For Information Interchange) is the original
 7-bit character set, originally designed for American English.  It is
 currently described by the ECMA-6 standard.
 .LP
-An ASCII variant replacing the American crosshatch/octothorpe/hash pound
-symbol with the British pound-sterling symbol is used in Great
-Britain; when needed, the American and British variants may be
-distinguished as "US ASCII" and "UK ASCII".
+Various ASCII variants replacing the dollar sign with other currency
+symbols and replacing punctuation with non-English alphabetic characters
+to cover German, French, Spanish and others in 7 bits exist. All are
+deprecated; GNU libc doesn't support locales whose character sets aren't
+true supersets of ASCII.
 .LP
-As Linux was written for hardware designed in the US, it natively 
-supports US ASCII.
+As Linux was written for hardware designed in the US, it natively
+supports ASCII.
 
 .SH ISO 8859
-ISO 8859 is a series of 10 8-bit character sets all of which have US
+ISO 8859 is a series of 15 8-bit character sets all of which have US
 ASCII in their low (7-bit) half, invisible control characters in
 positions 128 to 159, and 96 fixed-width graphics in positions 160-255.
 .LP
@@ -48,19 +57,21 @@
 .LP
 Console support for the other 8859 character sets is available under
 Linux through user-mode utilities (such as
-.BR setfont (8)) 
+.\" .BR setfont (8)) // Is this still in use anywhere? All
+.\" // I have is consolechars
+.BR consolechars (8))
 that modify keyboard bindings and the EGA graphics
 table and employ the "user mapping" font table in the console
 driver.
 .LP
 Here are brief descriptions of each set:
 .TP
-8859-1 (Latin-1) 
+8859-1 (Latin-1)
 Latin-1 covers most Western European languages such as Albanian, Catalan,
 Danish, Dutch, English, Faroese, Finnish, French, German, Galician,
 Irish, Icelandic, Italian, Norwegian, Portuguese, Spanish, and
 Swedish. The lack of the ligatures Dutch ij, French oe and old-style
-,,German`` quotation marks is tolerable.
+,,German`` quotation marks is considered tolerable.
 .TP
 8859-2 (Latin-2)
 Latin-2 supports most Latin-written Slavic and Central European
@@ -68,13 +79,17 @@
 Slovak, and Slovene.
 .TP
 8859-3 (Latin-3)
-Latin-3 is popular with authors of Esperanto, Galician, Maltese, and Turkish.
+Latin-3 is popular with authors of Esperanto, Galician, and Maltese.
+(Turkish is now written with 8859-9 instead.)
 .TP
 8859-4 (Latin-4)
 Latin-4 introduced letters for Estonian, Latvian, and Lithuanian.  It
-is essentially obsolete; see 8859-10 (Latin-6).
+is essentially obsolete; see 8859-13 (Latin-7).
+.\" Original manpage referred to 8859-10 (Latin-6). My sources don't
+.\" mention 8859-10 in conjunction with those languages, but I'm not
+.\" confident enough to be sure it was wrong.
 .TP
-8859-5 
+8859-5
 Cyrillic letters supporting Bulgarian, Byelorussian, Macedonian,
 Russian, Serbian and Ukrainian.  Ukrainians read the letter `ghe'
 with downstroke as `heh' and would need a ghe with upstroke to write a
@@ -89,43 +104,114 @@
 Supports Modern Greek.
 .TP
 8859-8
-Supports Hebrew.
+Supports modern Hebrew without niqud (punctuation signs). Niqud
+and full-fledged Biblical Hebrew are outside the scope of this
+character set; under Linux, UTF-8 is the preferred encoding for
+these.
 .TP
 8859-9 (Latin-5)
-This is a variant of Latin-1 that replaces rarely-used Icelandic
-letters with Turkish ones.
+This is a variant of Latin-1 that replaces Icelandic letters with
+Turkish ones.
 .TP
-8859-10 (Latin-6) 
+8859-10 (Latin-6)
 Latin 6 adds the last Inuit (Greenlandic) and Sami (Lappish) letters
 that were missing in Latin 4 to cover the entire Nordic area.  RFC
 1345 listed a preliminary and different `latin6'. Skolt Sami still
 needs a few more accents than these.
 .TP
+8859-11
+This only exists as a rejected draft standard. The draft standard
+was identical to TIS-620, which is used under Linux for Thai.
+.TP
+8859-12
+This set does not exist. While Vietnamese has been suggested for this
+space, it does not fit within the 96 (non-combining) characters ISO
+8859 offers. UTF-8 is the preferred character set for Vietnamese use
+under Linux.
+.TP
 8859-13 (Latin-7)
+Supports the Baltic Rim languages; in particular, it includes Latvian
+characters not found in Latin-4.
 .TP
 8859-14 (Latin-8)
+This is the Celtic character set, covering Gaelic and Welsh.
 .TP
-8859-15
-This adds the Euro sign and French ligatures that were missing in
+8859-15 (Latin-9)
+This adds the Euro sign and French and Finnish letters that were missing in
 Latin-1.
+.TP
+8859-16 (Latin-10)
+This set covers many of the languages covered by 8859-2, and supports
+Romanian more completely then that set does.
 .SH KOI8-R
 KOI8-R is a non-ISO character set popular in Russia.  The lower half
 is US ASCII; the upper is a Cyrillic character set somewhat better
-designed than ISO 8859-5.  
+designed than ISO 8859-5. KOI8-U is a common character set, based off
+KOI8-R, that has better support for Ukrainian. Neither of these sets
+are ISO-2022 compatible, unlike the ISO-8859 series.
 .LP
 Console support for KOI8-R is available under Linux through user-mode
 utilities that modify keyboard bindings and the EGA graphics table,
 and employ the "user mapping" font table in the console driver.
+
+.\" Thanks to Tomohiro KUBOTA for the following sections about 
+.\" national standards.
+.SH JIS X 0208
+JIS X 0208 is a Japanese national standard character set. Though
+there are some more Japanese national standard character sets (like
+JIS X 0201, JIS X 0212, and JIS X 0213), this is the most important
+one. Characters are mapped into a 94x94 two-byte matrix,
+whose each byte is in the range 0x21-0x7e. Note that JIS X 0208
+is a character set, not an encoding. This means that JIS X 0208
+itself is not used for expressing text data. JIS X 0208 is used
+as a component to construct encodings such as EUC-JP, Shift_JIS,
+and ISO-2022-JP. EUC-JP is the most important encoding for Linux
+and includes US ASCII and JIS X 0208. In EUC-JP, JIS X 0208
+characters are expressed in two bytes, each of which is the
+JIS X 0208 code plus 0x80.
+
+.SH KS X 1001
+KS X 1001 is a Korean national standard character set. Just as
+JIS X 0208, characters are mapped into a 94x94 two-byte matrix.
+KS X 1001 is used like JIS X 0208, as a component
+to construct encodings such as EUC-KR, Johab, and ISO-2022-KR.
+EUC-KR is the most important encoding for Linux and includes
+US ASCII and KS X 1001. KS C 5601 is an older name for KS X 1001.
+
+.SH GB 2312
+GB 2312 is a mainland Chinese national standard character set used
+to express simplified Chinese. Just like JIS X 0208, characters are
+mapped into a 94x94 two-byte matrix used to construct EUC-CN.  EUC-CN
+is the most important encoding for Linux and includes US ASCII and
+GB 2312.  Note that EUC-CN is often called as GB, GB 2312, or CN-GB.
+
+.SH Big5
+Big5 is a popular character set in Taiwan to express traditional
+Chinese. (Big5 is both a character set and an encoding.) It is a
+superset of US ASCII. Non-ASCII characters are expressed in two
+bytes. Bytes 0xa1-0xfe are used as leading bytes for two-byte
+characters. Big5 and its extension is widely used in Taiwan and Hong
+Kong. It is not ISO 2022-compliant.
+
+.SH TIS 620
+TIS 620 is a Thai national standard character set and a superset
+of US ASCII. Like ISO 8859 series, Thai characters are mapped into
+0xa1-0xfe. TIS 620 is the only commonly used character set under
+Linux besides UTF-8 to have combining characters.
+
 .SH UNICODE
 Unicode (ISO 10646) is a standard which aims to unambiguously represent every
-known glyph in every human language.  Unicode's native encoding
-is 32-bit (older versions used 16 bits).  Information on Unicode is
-available at <http://www.unicode.com>.
+character in every human language.  Unicode's structure permits 20.1 bits
+to encode every character. Since most computers don't include 20.1-bit
+integers, Unicode is usually encoded as 32-bit integers internally and
+either a series of 16-bit integers (UTF-16) (needing two 16-bit integers
+only when encoding certain rare characters) or a series of 8-bit bytes
+(UTF-8). Information on Unicode is available at <http://www.unicode.com>.
 .LP
-Linux represents Unicode using the 8-bit Unicode Transfer Format
+Linux represents Unicode using the 8-bit Unicode Transformation Format
 (UTF-8).  UTF-8 is a variable length encoding of Unicode.  It uses 1
-byte to code 7 bits, 2 bytes for 11 bits, 3 bytes for 16 bits, 4 bytes
-for 21 bits, 5 bytes for 26 bits, 6 bytes for 31 bits.
+byte to code 7 bits, 2 bytes for 11 bits, 3 bytes for 16 bits, and 4 bytes
+for the remainder.
 .LP
 Let 0,1,x stand for a zero, one, or arbitrary bit.  A byte 0xxxxxxx
 stands for the Unicode 00000000 0xxxxxxx which codes the same symbol
@@ -134,19 +220,21 @@
 in file size.
 .LP
 A byte 110xxxxx is the start of a 2-byte code, and 110xxxxx 10yyyyyy
-is assembled into 00000xxx xxyyyyyy.  A byte 1110xxxx is the start of
-a 3-byte code, and 1110xxxx 10yyyyyy 10zzzzzz is assembled into
-xxxxyyyy yyzzzzzz.  (When UTF-8 is used to code the 31-bit ISO 10646
-then this progression continues up to 6-byte codes.)
-.LP
-For ISO-8859-1 users this means that the characters with high bit set
-now are coded with two bytes. This tends to expand ordinary text files
-by one or two percent.  There are no conversion problems, however,
-since the Unicode value of ISO-8859-1 symbols equals their ISO-8859-1
-value (extended by eight leading zero bits).  For Japanese users this
-means that the 16-bit codes now in common use will take three bytes,
-and extensive mapping tables are required. Many Japanese therefore
-prefer ISO 2022.
+is assembled into 00000000 0000000 00000xxx xxyyyyyy.  A byte 1110xxxx
+is the start of a 3-byte code, and 1110xxxx 10yyyyyy 10zzzzzz is assembled
+into 00000000 00000000 xxxxyyyy yyzzzzzz.  Lastly, 110110xxx starts a 4-byte
+code, and 110110xxx 10xxyyyy 10zzzzzz 10aaaaaa becomes 0000000 000xxxxx
+yyyyzzzz zzaaaaaa.
+.LP
+For most people who use ISO-8859 character sets, this means that the
+characters outside of ASCII are now coded with two bytes. This tends
+to expand ordinary text files by only one or two percent. For Russian
+or Greek users, this expands ordinary text files by 100%, since text in
+those languages is mostly outside of ASCII. For Japanese users this means
+that the 16-bit codes now in common use will take three bytes. While there
+are algorithmic conversions from some character sets (esp. ISO-8859-1) to
+Unicode, general conversion requires carrying around conversion tables,
+which can be quite large for 16-bit codes.
 .LP
 Note that UTF-8 is self-synchronizing: 10xxxxxx is a tail, any other
 byte is the head of a code.  Note that the only way ASCII bytes occur
@@ -163,10 +251,14 @@
 This means that in UTF-8 mode one can use a character set with 512
 different symbols.  This is not enough for Japanese, Chinese and
 Korean, but it is enough for most other purposes.
+.LP
+At the current time, the console driver does not handle combining
+characters. So Thai, Sioux and any other script needing combining
+characters can't be handled on the console.
 
 .SH ISO 2022 AND ISO 4873
 The ISO 2022 and 4873 standards describe a font-control model
-based on VT100 practice.  This model is (partially) supported 
+based on VT100 practice.  This model is (partially) supported
 by the Linux kernel and by
 .BR xterm (1).
 It is popular in Japan and Korea.
