3 Encode::Supported -- Encodings supported by Encode
9 Encoding names are case insensitive. White space in names
10 is ignored. In addition, an encoding may have aliases.
11 Each encoding has one "canonical" name. The "canonical"
12 name is chosen from the names of the encoding by picking
13 the first in the following sequence (with a few exceptions).
19 The name used by the Perl community. That includes 'utf8' and 'ascii'.
20 Unlike aliases, canonical names directly reach the method so such
21 frequently used words like 'utf8' don't need to do alias lookups.
25 The MIME name as defined in IETF RFCs. This includes all "iso-"s.
29 The name in the IANA registry.
33 The name used by the organization that defined it.
37 In case I<de jure> canonical names differ from that of the Encode
38 module, they are always aliased if it ever be implemented. So you can
39 safely tell if a given encoding is implemented or not just by passing
42 Because of all the alias issues, and because in the general case
43 encodings have state, "Encode" uses an encoding object internally
44 once an operation is in progress.
46 =head1 Supported Encodings
48 As of Perl 5.8.0, at least the following encodings are recognized.
49 Note that unless otherwise specified, they are all case insensitive
50 (via alias) and all occurrence of spaces are replaced with '-'.
51 In other words, "ISO 8859 1" and "iso-8859-1" are identical.
53 Encodings are categorized and implemented in several different modules
54 but you don't have to C<use Encode::XX> to make them available for
55 most cases. Encode.pm will automatically load those modules on demand.
57 =head2 Built-in Encodings
59 The following encodings are always available.
61 Canonical Aliases Comments & References
62 ----------------------------------------------------------------
63 ascii US-ascii ISO-646-US [ECMA]
64 ascii-ctrl Special Encoding
65 iso-8859-1 latin1 [ISO]
68 ----------------------------------------------------------------
70 I<null> and I<ascii-ctrl> are special. "null" fails for all character
71 so when you set fallback mode to PERLQQ, HTMLCREF or XMLCREF, ALL
72 CHARACTERS will fall back to character references. Ditto for
73 "ascii-ctrl" except for control characters. For fallback modes, see
76 =head2 Encode::Unicode -- other Unicode encodings
78 Unicode coding schemes other than native utf8 are supported by
79 Encode::Unicode, which will be autoloaded on demand.
81 ----------------------------------------------------------------
82 UCS-2BE UCS-2, iso-10646-1 [IANA, UC]
91 ----------------------------------------------------------------
93 To find how (UCS-2|UTF-(16|32))(LE|BE)? differ from one another,
94 see L<Encode::Unicode>.
96 UTF-7 is a special encoding which "re-encodes" UTF-16BE into a 7-bit
97 encoding. It is implemeneted seperately by Encode::Unicode::UTF7.
99 =head2 Encode::Byte -- Extended ASCII
101 Encode::Byte implements most single-byte encodings except for
102 Symbols and EBCDIC. The following encodings are based on single-byte
103 encodings implemented as extended ASCII. Most of them map
104 \x80-\xff (upper half) to non-ASCII characters.
108 =item ISO-8859 and corresponding vendor mappings
110 Since there are so many, they are presented in table format with
111 languages and corresponding encoding names by vendors. Note that
112 the table is sorted in order of ISO-8859 and the corresponding vendor
113 mappings are slightly different from that of ISO. See
114 L<http://czyborra.com/charsets/iso8859.html> for details.
116 Lang/Regions ISO/Other Std. DOS Windows Macintosh Others
117 ----------------------------------------------------------------
118 N. America (ASCII) cp437 AdobeStandardEncoding
120 W. Europe iso-8859-1 cp850 cp1252 MacRoman nextstep
122 cp860 (DOSPortuguese)
123 Cntrl. Europe iso-8859-2 cp852 cp1250 MacCentralEurRoman
129 Cyrillics iso-8859-5 cp855 cp1251 MacCyrillic
130 (See also next section) cp866 MacUkrainian
131 Arabic iso-8859-6 cp864 cp1256 MacArabic
133 Greek iso-8859-7 cp737 cp1253 MacGreek
135 Hebrew iso-8859-8 cp862 cp1255 MacHebrew
136 Turkish iso-8859-9 cp857 cp1254 MacTurkish
137 Nordics iso-8859-10 cp865
140 Thai iso-8859-11[3] cp874 MacThai
141 (iso-8859-12 is nonexistent. Reserved for Indics?)
142 Baltics iso-8859-13 cp775 cp1257
144 Latin9 [4] iso-8859-15
146 Vietnamese viscii cp1258 MacVietnamese
147 ----------------------------------------------------------------
149 [1] Esperanto, Maltese, and Turkish. Turkish is now on 8859-9.
150 [2] Baltics. Now on 8859-10, except for Latvian.
151 [3] TIS 620 + Non-Breaking Space (0xA0 / U+00A0)
152 [4] Nicknamed Latin0; the Euro sign as well as French and Finnish
153 letters that are missing from 8859-1 were added.
155 All cp* are also available as ibm-*, ms-*, and windows-* . See also
156 L<http://czyborra.com/charsets/codepages.html>.
158 Macintosh encodings don't seem to be registered in such entities as
159 IANA. "Canonical" names in Encode are based upon Apple's Tech Note
160 1150. See L<http://developer.apple.com/technotes/tn/tn1150.html>
163 =item KOI8 - De Facto Standard for the Cyrillic world
165 Though ISO-8859 does have ISO-8859-5, the KOI8 series is far more
166 popular in the Net. L<Encode> comes with the following KOI charsets.
167 For gory details, see L<http://czyborra.com/charsets/cyrillic.html>
169 ----------------------------------------------------------------
171 koi8-r cp878 [RFC1489]
173 ----------------------------------------------------------------
175 =item gsm0338 - Hentai Latin 1
177 GSM0338 is for GSM handsets. Though it shares alphanumerals with
178 ASCII, control character ranges and other parts are mapped very
179 differently, presumably to store Greek and Cyrillic alphabets.
180 This is also covered in Encode::Byte even though it is not an
181 "extended ASCII" encoding.
185 =head2 CJK: Chinese, Japanese, Korean (Multibyte)
187 Note that Vietnamese is listed above. Also read "Encoding vs Charset"
188 below. Also note that these are implemented in distinct modules by
189 countries, due to the size concerns (simplified Chinese is mapped
190 to 'CN', continental China, while traditional Chinese is mapped to
191 'TW', Taiwan). Please refer to their respective documentation pages.
195 =item Encode::CN -- Continental China
197 Standard DOS/Win Macintosh Comment/Reference
198 ----------------------------------------------------------------
199 euc-cn [1] MacChineseSimp
201 gb12345-raw { GB12345 without CES }
202 gb2312-raw { GB2312 without CES }
205 ----------------------------------------------------------------
207 [1] GB2312 is aliased to this. See L<Microsoft-related naming mess>
208 [2] gbk is aliased to this. See L<Microsoft-related naming mess>
210 =item Encode::JP -- Japan
212 Standard DOS/Win Macintosh Comment/Reference
213 ----------------------------------------------------------------
215 shiftjis cp932 macJapanese
217 iso-2022-jp [RFC1468]
218 iso-2022-jp-1 [RFC2237]
219 jis0201-raw { JIS X 0201 (roman + halfwidth kana) without CES }
220 jis0208-raw { JIS X 0208 (Kanji + fullwidth kana) without CES }
221 jis0212-raw { JIS X 0212 (Extended Kanji) without CES }
222 ----------------------------------------------------------------
224 =item Encode::KR -- Korea
226 Standard DOS/Win Macintosh Comment/Reference
227 ----------------------------------------------------------------
228 euc-kr MacKorean [RFC1557]
230 iso-2022-kr [RFC1557]
231 johab [KS X 1001:1998, Annex 3]
232 ksc5601-raw { KSC5601 without CES }
233 ----------------------------------------------------------------
235 [1] ks_c_5601-1987, (x-)?windows-949, and uhc are aliased to this.
238 =item Encode::TW -- Taiwan
240 Standard DOS/Win Macintosh Comment/Reference
241 ----------------------------------------------------------------
242 big5-eten cp950 MacChineseTrad {big5 aliased to big5-eten}
244 ----------------------------------------------------------------
246 =item Encode::HanExtra -- More Chinese via CPAN
248 Due to the size concerns, additional Chinese encodings below are
249 distributed separately on CPAN, under the name Encode::HanExtra.
251 Standard DOS/Win Macintosh Comment/Reference
252 ----------------------------------------------------------------
253 big5ext CMEX's Big5e Extension
254 big5plus CMEX's Big5+ Extension
255 cccii Chinese Character Code for Information Interchange
256 euc-tw EUC (Extended Unix Character)
257 gb18030 GBK with Traditional Characters
258 ----------------------------------------------------------------
260 =item Encode::JIS2K -- JIS X 0213 encodings via CPAN
262 Due to size concerns, additional Japanese encodings below are
263 distributed separately on CPAN, under the name Encode::JIS2K.
265 Standard DOS/Win Macintosh Comment/Reference
266 ----------------------------------------------------------------
272 ----------------------------------------------------------------
276 =head2 Miscellaneous encodings
282 See L<perlebcdic> for details.
284 ----------------------------------------------------------------
291 ----------------------------------------------------------------
293 =item Encode::Symbols
295 For symbols and dingbats.
297 ----------------------------------------------------------------
303 ----------------------------------------------------------------
305 =item Encode::MIME::Header
307 Strictly speaking, MIME header encoding documented in RFC 2047 is more
308 of encapsulation than encoding. However, their support in modern
309 world is imperative so they are supported.
311 ----------------------------------------------------------------
312 MIME-Header [RFC2047]
315 ----------------------------------------------------------------
319 This one is not a name of encoding but a utility that lets you pick up
320 the most appropriate encoding for a data out of given I<suspects>. See
321 L<Encode::Guess> for details.
325 =head1 Unsupported encodings
327 The following encodings are not supported as yet; some because they
328 are rarely used, some because of technical difficulties. They may
329 be supported by external modules via CPAN in the future, however.
333 =item ISO-2022-JP-2 [RFC1554]
335 Not very popular yet. Needs Unicode Database or equivalent to
336 implement encode() (because it includes JIS X 0208/0212, KSC5601, and
337 GB2312 simultaneously, whose code points in Unicode overlap. So you
338 need to lookup the database to determine to what character set a given
339 Unicode character should belong).
341 =item ISO-2022-CN [RFC1922]
343 Not very popular. Needs CNS 11643-1 and -2 which are not available in
344 this module. CNS 11643 is supported (via euc-tw) in Encode::HanExtra.
345 Autrijus Tang may add support for this encoding in his module in future.
347 =item Various HP-UX encodings
349 The following are unsupported due to the lack of mapping data.
351 '8' - arabic8, greek8, hebrew8, kana8, thai8, and turkish8
352 '15' - japanese15, korean15, and roi15
354 =item Cyrillic encoding ISO-IR-111
356 Anton Tagunov doubts its usefulness.
358 =item ISO-8859-8-1 [Hebrew]
360 None of the Encode team knows Hebrew enough (ISO-8859-8, cp1255 and
361 MacHebrew are supported because and just because there were mappings
362 available at L<http://www.unicode.org/>). Contributions welcome.
364 =item ISIRI 3342, Iran System, ISIRI 2900 [Farsi]
368 =item Thai encoding TCVN
372 =item Vietnamese encodings VPS
374 Though Jungshik Shin has reported that Mozilla supports this encoding,
375 it was too late before 5.8.0 for us to add it. In the future, it
376 may be available via a separate module. See
377 L<http://lxr.mozilla.org/seamonkey/source/intl/uconv/ucvlatin/vps.uf>
379 L<http://lxr.mozilla.org/seamonkey/source/intl/uconv/ucvlatin/vps.ut>
380 if you are interested in helping us.
382 =item Various Mac encodings
384 The following are unsupported due to the lack of mapping data.
386 MacArmenian, MacBengali, MacBurmese, MacEthiopic
387 MacExtArabic, MacGeorgian, MacKannada, MacKhmer
388 MacLaotian, MacMalayalam, MacMongolian, MacOriya
389 MacSinhalese, MacTamil, MacTelugu, MacTibetan
392 The rest which are already available are based upon the vendor mappings
393 at L<http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/> .
395 =item (Mac) Indic encodings
397 The maps for the following are available at L<http://www.unicode.org/>
398 but remain unsupport because those encodings need algorithmical
399 approach, currently unsupported by F<enc2xs>:
405 For details, please see C<Unicode mapping issues and notes:> at
406 L<http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/DEVANAGA.TXT> .
408 I believe this issue is prevalent not only for Mac Indics but also in
409 other Indic encodings, but the above were the only Indic encodings
410 maps that I could find at L<http://www.unicode.org/> .
414 =head1 Encoding vs. Charset -- terminology
416 We are used to using the term (character) I<encoding> and I<character
417 set> interchangeably. But just as confusing the terms byte and
418 character is dangerous and the terms should be differentiated when
419 needed, we need to differentiate I<encoding> and I<character set>.
421 To understand that, here is a description of how we make computers
428 First we start with which characters to include. We call this
429 collection of characters I<character repertoire>.
433 Then we have to give each character a unique ID so your computer can
434 tell the difference between 'a' and 'A'. This itemized character
435 repertoire is now a I<character set>.
439 If your computer can grow the character set without further
440 processing, you can go ahead and use it. This is called a I<coded
441 character set> (CCS) or I<raw character encoding>. ASCII is used this
446 But in many cases, especially multi-byte CJK encodings, you have to
447 tweak a little more. Your network connection may not accept any data
448 with the Most Significant Bit set, and your computer may not be able to
449 tell if a given byte is a whole character or just half of it. So you
450 have to I<encode> the character set to use it.
452 A I<character encoding scheme> (CES) determines how to encode a given
453 character set, or a set of multiple character sets. 7bit ISO-2022 is
454 an example of a CES. You switch between character sets via I<escape
459 Technically, or mathematically, speaking, a character set encoded in
460 such a CES that maps character by character may form a CCS. EUC is such
461 an example. The CES of EUC is as follows:
471 Map such a character set that consists of 94 or 96 powered by N
472 members by adding 0x80 to each byte.
476 You can also use 0x8e and 0x8f to indicate that the following sequence of
477 characters belongs to yet another character set. To each following byte
478 is added the value 0x80.
482 By carefully looking at the encoded byte sequence, you can find that the
483 byte sequence conforms a unique number. In that sense, EUC is a CCS
484 generated by a CES above from up to four CCS (complicated?). UTF-8
485 falls into this category. See L<perlUnicode/"UTF-8"> to find out how
486 UTF-8 maps Unicode to a byte sequence.
488 You may also have found out by now why 7bit ISO-2022 cannot comprise
489 a CCS. If you look at a byte sequence \x21\x21, you can't tell if
490 it is two !'s or IDEOGRAPHIC SPACE. EUC maps the latter to \xA1\xA1
491 so you have no trouble differentiating between "!!". and S<" ">.
493 =head1 Encoding Classification (by Anton Tagunov and Dan Kogai)
495 This section tries to classify the supported encodings by their
496 applicability for information exchange over the Internet and to
497 choose the most suitable aliases to name them in the context of
504 To (en|de)code encodings marked by C<(**)>, you need
505 C<Encode::HanExtra>, available from CPAN.
511 US-ASCII UTF-8 ISO-8859-* KOI8-R
512 Shift_JIS EUC-JP ISO-2022-JP ISO-2022-JP-1
515 are registered with IANA as preferred MIME names and may
516 be used over the Internet.
518 C<Shift_JIS> has been officialized by JIS X 0208:1997.
519 L<Microsoft-related naming mess> gives details.
521 C<GB2312> is the IANA name for C<EUC-CN>.
522 See L<Microsoft-related naming mess> for details.
524 C<GB_2312-80> I<raw> encoding is available as C<gb2312-raw>
525 with Encode. See L<Encode::CN> for details.
530 have not been registered with IANA (as of March 2002) but
531 seem to be supported by major web browsers.
532 The IANA name for C<EUC-CN> is C<GB2312>.
537 See L<Microsoft-related naming mess> for details.
539 C<KS_C_5601-1987> I<raw> encoding is available as C<kcs5601-raw>
540 with Encode. See L<Encode::KR> for details.
542 UTF-16 UTF-16BE UTF-16LE
544 are IANA-registered C<charset>s. See [RFC 2781] for details.
545 Jungshik Shin reports that UTF-16 with a BOM is well accepted
546 by MS IE 5/6 and NS 4/6. Beware however that
552 C<UTF-16> support in any software you're going to be
553 using/interoperating with has probably been less tested
554 then C<UTF-8> support
558 C<UTF-8> coded data seamlessly passes traditional
559 command piping (C<cat>, C<more>, etc.) while C<UTF-16> coded
560 data is likely to cause confusion (with its zero bytes,
565 it is beyond the power of words to describe the way HTML browsers
566 encode non-C<ASCII> form data. To get a general impression, visit
567 L<http://ppewww.ph.gla.ac.uk/~flavell/charset/form-i18n.html>.
568 While encoding of form data has stabilized for C<UTF-8> encoded pages
569 (at least IE 5/6, NS 6, and Opera 6 behave consistently), be sure to
570 expect fun (and cross-browser discrepancies) with C<UTF-16> encoded
575 The rule of thumb is to use C<UTF-8> unless you know what
576 you're doing and unless you really benefit from using C<UTF-16>.
581 GB 18030 (**) (see links bellow)
584 are totally valid encodings but not registered at IANA.
585 The names under which they are listed here are probably the
586 most widely-known names for these encodings and are recommended
591 is a proprietary name.
593 =head2 Microsoft-related naming mess
595 Microsoft products misuse the following names:
601 Microsoft extension to C<EUC-KR>.
603 Proper names: C<CP949>, C<UHC>, C<x-windows-949> (as used by Mozilla).
605 See L<http://lists.w3.org/Archives/Public/ietf-charsets/2001AprJun/0033.html>
608 Encode aliases C<KS_C_5601-1987> to C<cp949> to reflect this common
609 misusage. I<Raw> C<KS_C_5601-1987> encoding is available as
612 See L<Encode::KR> for details.
616 Microsoft extension to C<EUC-CN>.
618 Proper names: C<CP936>, C<GBK>.
620 C<GB2312> has been registered in the C<EUC-CN> meaning at
621 IANA. This has partially repaired the situation: Microsoft's
622 C<GB2312> has become a superset of the official C<GB2312>.
624 Encode aliases C<GB2312> to C<euc-cn> in full agreement with
625 IANA registration. C<cp936> is supported separately.
626 I<Raw> C<GB_2312-80> encoding is available as C<gb2312-raw>.
628 See L<Encode::CN> for details.
632 Microsoft extension to C<Big5>.
634 Proper name: C<CP950>.
636 Encode separately supports C<Big5> and C<cp950>.
640 Microsoft's understanding of C<Shift_JIS>.
642 JIS has not endorsed the full Microsoft standard however.
643 The official C<Shift_JIS> includes only JIS X 0201 and JIS X 0208
644 character sets, while Microsoft has always used C<Shift_JIS>
645 to encode a wider character repertoire. See C<IANA> registration for
648 As a historical predecessor, Microsoft's variant
649 probably has more rights for the name, though it may be objected
650 that Microsoft shouldn't have used JIS as part of the name
653 Unambiguous name: C<CP932>. C<IANA> name (not used?): C<Windows-31J>.
655 Encode separately supports C<Shift_JIS> and C<cp932>.
663 =item character repertoire
665 A collection of unique characters. A I<character> set in the strictest
666 sense. At this stage, characters are not numbered.
668 =item coded character set (CCS)
670 A character set that is mapped in a way computers can use directly.
671 Many character encodings, including EUC, fall in this category.
673 =item character encoding scheme (CES)
675 An algorithm to map a character set to a byte sequence. You don't
676 have to be able to tell which character set a given byte sequence
677 belongs. 7-bit ISO-2022 is a CES but it cannot be a CCS. EUC is an
678 example of being both a CCS and CES.
680 =item charset (in MIME context)
682 has long been used in the meaning of C<encoding>, CES.
684 While the word combination C<character set> has lost this meaning
685 in MIME context since [RFC 2130], the C<charset> abbreviation has
686 retained it. This is how [RFC 2277] and [RFC 2278] bless C<charset>:
688 This document uses the term "charset" to mean a set of rules for
689 mapping from a sequence of octets to a sequence of characters, such
690 as the combination of a coded character set and a character encoding
691 scheme; this is also what is used as an identifier in MIME "charset="
692 parameters, and registered in the IANA charset registry ... (Note
693 that this is NOT a term used by other standards bodies, such as ISO).
698 Extended Unix Character. See ISO-2022.
702 A CES that was carefully designed to coexist with ASCII. There are a 7
703 bit version and an 8 bit version.
705 The 7 bit version switches character set via escape sequence so it
706 cannot form a CCS. Since this is more difficult to handle in programs
707 than the 8 bit version, the 7 bit version is not very popular except for
708 iso-2022-jp, the I<de facto> standard CES for e-mails.
710 The 8 bit version can form a CCS. EUC and ISO-8859 are two examples
711 thereof. Pre-5.6 perl could use them as string literals.
715 Short for I<Universal Character Set>. When you say just UCS, it means
720 ISO/IEC 10646 encoding form: Universal Character Set coded in two
725 A character set that aims to include all character repertoires of the
726 world. Many character sets in various national as well as industrial
727 standards have become, in a way, just subsets of Unicode.
731 Short for I<Unicode Transformation Format>. Determines how to map a
732 Unicode character into a byte sequence.
736 A UTF in 16-bit encoding. Can either be in big endian or little
737 endian. The big endian version is called UTF-16BE (equal to UCS-2 +
738 surrogate support) and the little endian version is called UTF-16LE.
746 L<Encode::CN>, L<Encode::JP>, L<Encode::KR>, L<Encode::TW>,
747 L<Encode::EBCDIC>, L<Encode::Symbol>
748 L<Encode::MIME::Header>, L<Encode::Guess>
756 European Computer Manufacturers Association
757 L<http://www.ecma.ch>
761 =item ECMA-035 (eq C<ISO-2022>)
763 L<http://www.ecma.ch/ecma1/STAND/ECMA-035.HTM>
765 The specification of ISO-2022 is available from the link above.
771 Internet Assigned Numbers Authority
772 L<http://www.iana.org/>
776 =item Assigned Charset Names by IANA
778 L<http://www.iana.org/assignments/character-sets>
780 Most of the C<canonical names> in Encode derive from this list
781 so you can directly apply the string you have extracted from MIME
782 header of mails and web pages.
788 International Organization for Standardization
789 L<http://www.iso.ch/>
793 Request For Comments -- need I say more?
794 L<http://www.rfc-editor.org/>, L<http://www.rfc.net/>,
795 L<http://www.faqs.org/rfcs/>
800 L<http://www.unicode.org/>
804 =item Unicode Glossary
806 L<http://www.unicode.org/glossary/>
808 The glossary of this document is based upon this site.
814 =head2 Other Notable Sites
820 L<http://czyborra.com/>
822 Contains a a lot of useful information, especially gory details of ISO
827 L<http://www.oreilly.com/people/authors/lunde/cjk_inf.html>
829 Somewhat obsolete (last update in 1996), but still useful. Also try
831 L<ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/pdf/GB18030_Summary.pdf>
833 You will find brief info on C<EUC-CN>, C<GBK> and mostly on C<GB 18030>.
835 =item Jungshik Shin's Hangul FAQ
837 L<http://jshin.net/faq>
839 And especially its subject 8.
841 L<http://jshin.net/faq/qa8.html>
843 A comprehensive overview of the Korean (C<KS *>) standards.
845 =item debian.org: "Introduction to i18n"
847 A brief description for most of the mentioned CJK encodings is
849 L<http://www.debian.org/doc/manuals/intro-i18n/ch-codes.en.html>
853 =head2 Offline sources
857 =item C<CJKV Information Processing> by Ken Lunde
859 CJKV Information Processing
860 1999 O'Reilly & Associates, ISBN : 1-56592-224-7
862 The modern successor of C<CJK.inf>.
864 Features a comprehensive coverage of CJKV character sets and
865 encodings along with many other issues faced by anyone trying
866 to better support CJKV languages/scripts in all the areas of
867 information processing.
869 To purchase this book, visit
870 L<http://www.oreilly.com/catalog/cjkvinfo/>
871 or your favourite bookstore.