CHARSETS(7) Linux Programmer’s Manual CHARSETS(7)
名前
charsets - プログラマの視点から見た文字セットと国際化
説明
Linux は国際化されたオペレーティングシステムである。 Linux の様々なユー
ティリティや、 console ドライバなどのデバイスドライバは、非ラテンアルフ
ァベットなどのマルチリンガル文字セット (multilingual character sets) を
サポートしている。これらにはラテンアルファベット文字・ギリシャ文字・ キ
リ ル 文 字・アラビア文字・ヘブライ文字などが含まれ、発音区別符号 (dia-
critical marks)・アクセント・合字 (ligatures) なども使うことができる。
このマニュアルページでは、プログラマの視点からみた異なる文字集 合 規 格
(character-set standards) と、それらを Linux にどう適合させるかというこ
とについて述べる。ここでは、ASCII, ISO 8859, KOI8-R, Unicode, ISO 2022,
ISO 4873 の各規格について議論する。ここでは実際にロケール文字セットとし
て使われている文字セットに注目し、その他のシステムで使われている無数 の
ものは重視しない。
glibc 2.2.3 で公式に対応しているロケールで用いられている文字セットの完
全なリストは以 下 の 通 り: 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, TIS-620 (順不同) (ルーマニア語は ISO-8859-16 に切り替わって
いるかもしれない)
ASCII
ASCII (American Standard Code For Information Interchange) は 7 ビット
文字集合の元となったものであり、もともとは米語(American English) のため
にデザインされた。現在は、ECMA-6 標準の中で説明されている。
ド イ ツ語、フランス語、スペイン語などに 7 ビットで対応するため、 ASCII
のドル記号を他の通貨記号に置き換え、句読点を非英語文字のものに置き換 え
た 様 々な変種が存在する。これらは全て使うべきではない。 glibc は ASCII
の完全なスーパーセットでない文字セットのロケールに対応していない。 ( こ
れ らの文字セットは ISO-646 として知られる。これは ASCII と近い関係にあ
り、これらの文字を置き換えることを認めている)
Linux は米国で設計されたハードウェアのために書かれたので、はじ め か ら
ASCII をサポートしている。
ISO 8859
ISO 8859 は 15 組の一連の 8 ビット文字集合である。それらは全て下位 (7
ビット) に US ASCII を含み、 128 から 159 には制御文字が配置され、 160
から 255 には 96 個の固定幅図形文字が配置されている。
こ れらのうちで、もっとも重要なのは ISO 8859-1 (Latin-1) である。これは
Linux コンソールドライバにおいてネイティブにサポートされており、 X11R6
に おいても同様にサポートされている。さらに、 HTML の基本文字集合である
。
コンソールにおける、その他の 8859 文字集合のサポートは (setfont(8)) の
よ うなユーザモード・ユーティリティを利用する事で可能になる。このような
ユーティリティを利用することにより、コンソールドライバにおけるキーボ ー
ド と EGA グラフィックテーブルの割り当てを変更し、"ユーザ割り当て(user
mapping)"フォントテーブルを使用することができる。
以下は、それぞれの集合の簡単な説明である。
8859-1 (Latin-1)
Latin-1 は アルバニア語(Albanian)、カタロニア語(Catalan)、デンマ
ー ク 語 (Danish) 、 オランダ語(Dutch)、英語(English)、フェロー
語(Faroese)、フィンランド語(Finnish)、フランス語(French)、ドイツ
語(German) 、ガリシア語(Galician)、アイルランド語(Irish)、アイス
ランド語(Icelandic) 、 イ タ リ ア 語(Italian) 、 ノ ル ウ ェ ー
語(Norwegian)、ポルトガル語(Portuguese)、スペイン語(Spanish)、ス
ウェーデン語(Swedish)といったほとんどの西ヨーロッパ言語をカバ ー
する。ドイツ語の ij やフランス語の oe の合字、および古いスタイル
の ,,ドイツ語‘‘ 引用符はないが、許容範囲と考えられている。
8859-2 (Latin-2)
Latin-2 はスラヴ語(Slavic)、クロアチ ア 語(Croatian) 、 チ ェ コ
語(Czech)、ドイツ語(German)、ハンガリー語(Hungarian)、ポーランド
語 (Polish)、ルーマニア語(Rumanian)、スロヴァキア語(Slovak)、 ス
ロ ベニア語(Slovene)といった、書き文字としてラテン文字を使用する
、スラブ系言語と中央ヨーロッパの言語のほとんどをサポートする。
8859-3 (Latin-3)
Latin-3 はエスペラント(Esperanto)、ガリシア語(Galician)、マル タ
語 (Maltese) な ど の 書 き 手 の 間 で良く用いられる。 (トルコ
語(Turkish)はこれの代わりに 8859-9 で書かれるようになっている)
8859-4 (Latin-4)
Latin-4 はエストニア語(Estonian)、ラトビア語(Latvian)、リトア ニ
ア語 (Lithuanian)の文字を提供する。Latain-4 は、本質的には廃止さ
れている(obsolate で あ る) 。 8859-10 (Latin-6) と 8859-13
(Latin-7) を参照のこと。
8859-5
ブ ルガリア語(Bulgarian)、ベラルーシ語(Byelorussian)、マケドニア
語 (Macedonian)、ロシア語(Russian)、セルビア語(Serbian)、ウク ラ
イナ語 (Ukrainian) をサポートするキリル文字集合である。 ウクライ
ナ語では downstroke をつけた "ghe" という文字を "heh" と読 み 、
ghe を正しく書くには ghe に upstroke をつけなければならない。こ
の点については、下の KOI8-R に関する議論を参照のこと。
8859-6
アラビア語(Arabic)をサポートする。8859-6 のグリフテーブ ル(glyph
table) は文字の形態を分割した固定幅フォントである。そのため、適
切なディスプレイエンジンが正しい initial, medial, final フォーム
に結合しなければならない。
8859-7 現代ギリシャ語(Modern Greek)をサポートする。
8859-8 niqud( 句 読点記号) のない近代ヘブライ語(Hebrew)をサポートする。
niqud と完全な聖書風ヘブライ語(Biblical Hebrew)はこの文字セッ ト
の対象外である。 Linux では、これらのためには UTF-8 が好ましいエ
ンコーディングである。
8859-9 (Latin-5)
これは、Latin-1 の変種で、アイスラ ン ド 語 の 文 字 を ト ル コ
語(Turkish)文字に置き換えたものである。
8859-10 (Latin-6)
Latin-6 は北欧(Nordic)地域をカバーするために Latin-4 には含まれ
ていないイヌイット語(Inuit)(グリーンランド語(Greenlandic)) と サ
ーメ語(Sami)(ラップ語(Lappish)) を加えてある。 RFC 1345 には、こ
の前段階の、異なった "latin6" が載せられている。スコルト・サーメ
語(Skolt Sami)では、さらにいくつかのアクセント記号が必要とする。
8859-11
これは拒絶された草案標準のためだけに存在する。この草 案 標 準 は
Linux でタイ語のために用いられる TIS-620 と同じものである。
8859-12
この文字セットは存在しない。ベトナム語がこの場所を使うように提案
したが、 ISO 8859 が提案する(合成でない) 96 文字に収まらなかった
。 Linux ではベトナム語を扱う場合は UTF-8 が好ましい文字セットで
ある。
8859-13 (Latin-7)
バルト海諸国の言語をサポートする。特に、Latin-4 に存在しないラト
ビア語の文字を含む。
8859-14 (Latin-8)
こ れ はケルト語の文字セットであり、ゲール語(Gaelic)とウェールズ
語(Welsh)に対応する。この文字セットは古代アイルランド語で用い ら
れる付点付き文字も含む。
8859-15 (Latin-9)
こ れはユーロ記号と Latin-1 に入っていないフランス語とフィンラン
ド語の文字が追加されている。
8859-16 (Latin-10)
この文字セットは 8859-2 で対応する多くの言語に対応し、さらにルー
マニア語にはより完全に対応する。
KOI8-R
KOI8-R はロシアにおいて良く用いられる、ISO でない文字集合である。下位半
分は US ASCII である。上位半分は ISO 8859-5 より幾分良くデザインされ た
キ リル文字集合である。 KOI8-U は KOI8-R を元にした共通文字セットであり
、ウクライナ語(Ukrainian) によりよく対応する。これらのどちらも ISO-8859
シリーズのように ISO-2022 互換ではない。
Linux での KOI8-R のコンソールサポートは、ユーザモードのユーティリティ
で実現されている。これはキーボードの割り当てと EGA グラフィックテーブル
を 変更し、コンソールドライバのフォントテーブルに "ユーザ割り当て" を行
う。
JIS X 0208
JIS X 0208 は日本語の国定標準文字セットである。他にもいくつか日本語の国
定 標準文字セットはある (JIS X 0201, JIS X 0212, JIS X 0213 など)が、こ
れが最も重要である。文字は 94x94 の 2 バイトマトリックスに配置される 。
各バイトは 0x21-0x7e の値を持つ。 JIS X 0208 は文字セットであり、エンコ
ーディングではないことに注意すること。これは、 JIS X 0208 自身はテキ ス
ト デ ータの表現には使われない、ということである。 JIS X 0208 は、 EUC-
JP, Shift_JIS, ISO-2022-JP といったエンコーディングを構成する部品として
用いられる。 EUC-JP が Linux において最も重要なエンコーディングであり、
US ASCII と JIS X 0208 を含んでいる。 EUC-JP では、JIS X 0208 文字は 2
バ イトで表現され、各バイトは JIS X 0208 コードに 0x80 を加えたものであ
る。
KS X 1001
KS X 1001 は韓国の国定標準文字セットである。 JIS X 0208 と同様に、文 字
は 94x94 の 2 バイトマトリックスに配置される。 KS X 1001 は JIS X 0208
と同様に、 EUC-KR, Johab, ISO-2022-KR といったエンコーディングの部品 と
して用いられる。 EUC-KR は Linux において最も重要なエンコーディングであ
り、 US ASCII と KS X 1001 を含んでいる。 KS C 5601 は KS X 1001 の古い
名前である。
GB 2312
GB 2312 は、簡体文字を表現するための中国の国定標準文字セットである。
JIS X 0208 と同様に、文字は 94x94 の 2 バイトマトリックスに配置さ れ 、
EUC-CN に用いられる。 EUC-CN は Linux において最も重要なエンコーディン
グであり、 US ASCII と GB 2312 を含んでいる。 EUC-CN はしばしば GB, GB
2312, CN-GN などと呼ばれる。
Big5
Big5 は台湾で繁体文字を記述するのに一般的に使われる文字セットである。
(Big5 は文字セットとエンコーディングの両方である。) これは US ASCII の
上位集合である。非 ASCII 文字は 2 バイトで表現する。 0xa1-0xfe のバイト
は 2 バイト文字の 1 文字目として用いる。 Big5 とその拡張は台湾と香港 で
広く用いられている。これは ISO 2022 準拠ではない。
TIS 620
TIS 620 はタイの国定標準文字セットで、US ASCII の上位集合である。 ISO
8859 シリーズと同様に、タイ文字は 0xa1-0xfe に配置される。 TIS 620 は
Linux でのみ一般的に用いられている文字セットであり、また、UTF-8 は合成
文字も持っている。
UNICODE
Unicode (ISO10646) は、人間が用いる全ての言語の全ての文字を、明確にあら
わ す ことを目的とした規格である。 Unicode の構造は各文字のエンコードに
20.1 ビットを与えている。ほとんどのコンピューターは 20.1 ビットの整数を
扱えないので、 Unicode は普通内部データとして 32 ビット整数にエンコード
され、 16 ビット整数の列 (UTF-16)(ある種の珍しい文字をエンコードする 場
合 に だ け 2 つの 16 ビット整数が必要となる)か、 8 ビットバイトの列
(UTF-8)として扱われる。 Unicode について の 情 報 は 、
CHARSETS(7) Linux Programmer’s Manual CHARSETS(7)
NAME
charsets - programmer’s view of character sets and internationalization
DESCRIPTION
Linux is an international operating system. Various of its utilities
and device drivers (including the console driver) support multilingual
character sets including Latin-alphabet letters with diacritical marks,
accents, ligatures, and entire non-Latin alphabets including Greek,
Cyrillic, Arabic, and Hebrew.
This manual page presents a programmer’s-eye view of different charac-
ter-set standards and how they fit together on Linux. Standards dis-
cussed include ASCII, ISO 8859, KOI8-R, Unicode, ISO 2022 and ISO 4873.
The primary emphasis is on character sets actually used as locale char-
acter sets, not the myriad others that can be found in data from other
systems.
A complete list of charsets used in an 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.)
The recommended encoding in all settings and locales is UTF-8.
ASCII
ASCII (American Standard Code For Information Interchange) is the orig-
inal 7-bit character set, originally designed for American English. It
is currently described by the ECMA-6 standard.
Various ASCII variants replacing the dollar sign with other currency
symbols and replacing punctuation with non-English alphabetic charac-
ters to cover German, French, Spanish and others in 7 bits exist. All
are deprecated; glibc doesn’t support locales whose character sets
aren’t true supersets of ASCII. (These sets are also known as ISO-646,
a close relative of ASCII that permitted replacing these characters.)
As Linux was written for hardware designed in the US, it natively sup-
ports ASCII.
ISO 8859
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 posi-
tions 128 to 159, and 96 fixed-width graphics in positions 160-255.
Of these, the most important is ISO 8859-1 (Latin-1). It is natively
supported in the Linux console driver, fairly well supported in X11R6,
and is the base character set of HTML.
Console support for the other 8859 character sets is available under
Linux through user-mode utilities (such as setfont(8)) that modify key-
board bindings and the EGA graphics table and employ the "user mapping"
font table in the console driver.
Here are brief descriptions of each set:
8859-1 (Latin-1)
Latin-1 covers most Western European languages such as Albanian,
Catalan, Danish, Dutch, English, Faroese, Finnish, French, Ger-
man, 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 considered
tolerable.
8859-2 (Latin-2)
Latin-2 supports most Latin-written Slavic and Central European
languages: Croatian, Czech, German, Hungarian, Polish, Rumanian,
Slovak, and Slovene.
8859-3 (Latin-3)
Latin-3 is popular with authors of Esperanto, Galician, and Mal-
tese. (Turkish is now written with 8859-9 instead.)
8859-4 (Latin-4)
Latin-4 introduced letters for Estonian, Latvian, and Lithua-
nian. It is essentially obsolete; see 8859-10 (Latin-6) and
8859-13 (Latin-7).
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 correct ghe. See the discussion of KOI8-R
below.
8859-6 Supports Arabic. The 8859-6 glyph table is a fixed font of sep-
arate letter forms, but a proper display engine should combine
these using the proper initial, medial, and final forms.
8859-7 Supports Modern Greek.
8859-8 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.
8859-9 (Latin-5)
This is a variant of Latin-1 that replaces Icelandic letters
with Turkish ones.
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.
8859-11
This only exists as a rejected draft standard. The draft stan-
dard was identical to TIS-620, which is used under Linux for
Thai.
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.
8859-13 (Latin-7)
Supports the Baltic Rim languages; in particular, it includes
Latvian characters not found in Latin-4.
8859-14 (Latin-8)
This is the Celtic character set, covering Gaelic and Welsh.
This charset also contains the dotted characters needed for Old
Irish.
8859-15 (Latin-9)
This adds the Euro sign and French and Finnish letters that were
missing in Latin-1.
8859-16 (Latin-10)
This set covers many of the languages covered by 8859-2, and
supports Romanian more completely then that set does.
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. 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.
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.
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.
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.
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.
Big5
Big5 is a popular character set in Taiwan to express traditional Chi-
nese. (Big5 is both a character set and an encoding.) It is a super-
set 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.
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.
UNICODE
Unicode (ISO 10646) is a standard which aims to unambiguously represent
every 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 inte-
gers internally and either a series of 16-bit integers (UTF-16) (need-
ing 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
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa