📄 supported.pod
字号:
=head1 NAMEEncode::Supported -- Encodings supported by Encode=head1 DESCRIPTION=head2 Encoding NamesEncoding names are case insensitive. White space in namesis ignored. In addition, an encoding may have aliases.Each encoding has one "canonical" name. The "canonical"name is chosen from the names of the encoding by pickingthe first in the following sequence (with a few exceptions).=over 2=item *The name used by the Perl community. That includes 'utf8' and 'ascii'.Unlike aliases, canonical names directly reach the method so suchfrequently used words like 'utf8' don't need to do alias lookups.=item *The MIME name as defined in IETF RFCs. This includes all "iso-"s.=item * The name in the IANA registry.=item *The name used by the organization that defined it.=backIn case I<de jure> canonical names differ from that of the Encodemodule, they are always aliased if it ever be implemented. So you cansafely tell if a given encoding is implemented or not just by passing the canonical name.Because of all the alias issues, and because in the general case encodings have state, "Encode" uses an encoding object internally once an operation is in progress.=head1 Supported EncodingsAs of Perl 5.8.0, at least the following encodings are recognized.Note that unless otherwise specified, they are all case insensitive(via alias) and all occurrence of spaces are replaced with '-'.In other words, "ISO 8859 1" and "iso-8859-1" are identical.Encodings are categorized and implemented in several different modulesbut you don't have to C<use Encode::XX> to make them available formost cases. Encode.pm will automatically load those modules on demand.=head2 Built-in EncodingsThe following encodings are always available. Canonical Aliases Comments & References ---------------------------------------------------------------- ascii US-ascii ISO-646-US [ECMA] ascii-ctrl Special Encoding iso-8859-1 latin1 [ISO] null Special Encoding utf8 UTF-8 [RFC2279] ----------------------------------------------------------------I<null> and I<ascii-ctrl> are special. "null" fails for all characterso when you set fallback mode to PERLQQ, HTMLCREF or XMLCREF, ALLCHARACTERS will fall back to character references. Ditto for"ascii-ctrl" except for control characters. For fallback modes, seeL<Encode>.=head2 Encode::Unicode -- other Unicode encodingsUnicode coding schemes other than native utf8 are supported byEncode::Unicode, which will be autoloaded on demand. ---------------------------------------------------------------- UCS-2BE UCS-2, iso-10646-1 [IANA, UC] UCS-2LE [UC] UTF-16 [UC] UTF-16BE [UC] UTF-16LE [UC] UTF-32 [UC] UTF-32BE UCS-4 [UC] UTF-32LE [UC] UTF-7 [RFC2152] ----------------------------------------------------------------To find how (UCS-2|UTF-(16|32))(LE|BE)? differ from one another,see L<Encode::Unicode>. UTF-7 is a special encoding which "re-encodes" UTF-16BE into a 7-bitencoding. It is implemented seperately by Encode::Unicode::UTF7.=head2 Encode::Byte -- Extended ASCIIEncode::Byte implements most single-byte encodings except forSymbols and EBCDIC. The following encodings are based on single-byteencodings implemented as extended ASCII. Most of them map\x80-\xff (upper half) to non-ASCII characters.=over 2=item ISO-8859 and corresponding vendor mappingsSince there are so many, they are presented in table format withlanguages and corresponding encoding names by vendors. Note thatthe table is sorted in order of ISO-8859 and the corresponding vendormappings are slightly different from that of ISO. SeeL<http://czyborra.com/charsets/iso8859.html> for details. Lang/Regions ISO/Other Std. DOS Windows Macintosh Others ---------------------------------------------------------------- N. America (ASCII) cp437 AdobeStandardEncoding cp863 (DOSCanadaF) W. Europe iso-8859-1 cp850 cp1252 MacRoman nextstep hp-roman8 cp860 (DOSPortuguese) Cntrl. Europe iso-8859-2 cp852 cp1250 MacCentralEurRoman MacCroatian MacRomanian MacRumanian Latin3[1] iso-8859-3 Latin4[2] iso-8859-4 Cyrillics iso-8859-5 cp855 cp1251 MacCyrillic (See also next section) cp866 MacUkrainian Arabic iso-8859-6 cp864 cp1256 MacArabic cp1006 MacFarsi Greek iso-8859-7 cp737 cp1253 MacGreek cp869 (DOSGreek2) Hebrew iso-8859-8 cp862 cp1255 MacHebrew Turkish iso-8859-9 cp857 cp1254 MacTurkish Nordics iso-8859-10 cp865 cp861 MacIcelandic MacSami Thai iso-8859-11[3] cp874 MacThai (iso-8859-12 is nonexistent. Reserved for Indics?) Baltics iso-8859-13 cp775 cp1257 Celtics iso-8859-14 Latin9 [4] iso-8859-15 Latin10 iso-8859-16 Vietnamese viscii cp1258 MacVietnamese ---------------------------------------------------------------- [1] Esperanto, Maltese, and Turkish. Turkish is now on 8859-9. [2] Baltics. Now on 8859-10, except for Latvian. [3] TIS 620 + Non-Breaking Space (0xA0 / U+00A0) [4] Nicknamed Latin0; the Euro sign as well as French and Finnish letters that are missing from 8859-1 were added.All cp* are also available as ibm-*, ms-*, and windows-* . See alsoL<http://czyborra.com/charsets/codepages.html>.Macintosh encodings don't seem to be registered in such entities asIANA. "Canonical" names in Encode are based upon Apple's Tech Note1150. See L<http://developer.apple.com/technotes/tn/tn1150.html> for details.=item KOI8 - De Facto Standard for the Cyrillic worldThough ISO-8859 does have ISO-8859-5, the KOI8 series is far morepopular in the Net. L<Encode> comes with the following KOI charsets.For gory details, see L<http://czyborra.com/charsets/cyrillic.html> ---------------------------------------------------------------- koi8-f koi8-r cp878 [RFC1489] koi8-u [RFC2319] ----------------------------------------------------------------=back=head2 gsm0338 - Hentai Latin 1GSM0338 is for GSM handsets. Though it shares alphanumerals withASCII, control character ranges and other parts are mapped verydifferently, mainly to store Greek characters. There are also escapesequences (starting with 0x1B) to cover e.g. the Euro sign. This was once handled by L<Encode::Bytes> but because of all thoseunusual specifications, Encode 2.20 has relocated the support toL<Encode::GSM0338>. See L<Encode::GSM0338> for details.=over 2=item gsm0338 support before 2.19Some special cases like a trailing 0x00 byte or a lone 0x1B byte are notwell-defined and decode() will return an empty string for them.One possible workaround is $gsm =~ s/\x00\z/\x00\x00/; $uni = decode("gsm0338", $gsm); $uni .= "\xA0" if $gsm =~ /\x1B\z/;Note that the Encode implementation of GSM0338 does not implement thereuse of Latin capital letters as Greek capital letters (for example,the 0x5A is U+005A (LATIN CAPITAL LETTER Z), not U+0396 (GREEK CAPITALLETTER ZETA).The GSM0338 is also covered in Encode::Byte even though it is notan "extended ASCII" encoding.=back=head2 CJK: Chinese, Japanese, Korean (Multibyte)Note that Vietnamese is listed above. Also read "Encoding vs Charset"below. Also note that these are implemented in distinct modules bycountries, due to the size concerns (simplified Chinese is mappedto 'CN', continental China, while traditional Chinese is mapped to'TW', Taiwan). Please refer to their respective documentation pages.=over 2=item Encode::CN -- Continental China Standard DOS/Win Macintosh Comment/Reference ---------------------------------------------------------------- euc-cn [1] MacChineseSimp (gbk) cp936 [2] gb12345-raw { GB12345 without CES } gb2312-raw { GB2312 without CES } hz iso-ir-165 ---------------------------------------------------------------- [1] GB2312 is aliased to this. See L<Microsoft-related naming mess> [2] gbk is aliased to this. See L<Microsoft-related naming mess>=item Encode::JP -- Japan Standard DOS/Win Macintosh Comment/Reference ---------------------------------------------------------------- euc-jp shiftjis cp932 macJapanese 7bit-jis iso-2022-jp [RFC1468] iso-2022-jp-1 [RFC2237] jis0201-raw { JIS X 0201 (roman + halfwidth kana) without CES } jis0208-raw { JIS X 0208 (Kanji + fullwidth kana) without CES } jis0212-raw { JIS X 0212 (Extended Kanji) without CES } ----------------------------------------------------------------=item Encode::KR -- Korea Standard DOS/Win Macintosh Comment/Reference ---------------------------------------------------------------- euc-kr MacKorean [RFC1557] cp949 [1] iso-2022-kr [RFC1557] johab [KS X 1001:1998, Annex 3] ksc5601-raw { KSC5601 without CES } ---------------------------------------------------------------- [1] ks_c_5601-1987, (x-)?windows-949, and uhc are aliased to this. See below.=item Encode::TW -- Taiwan Standard DOS/Win Macintosh Comment/Reference ---------------------------------------------------------------- big5-eten cp950 MacChineseTrad {big5 aliased to big5-eten} big5-hkscs ----------------------------------------------------------------=item Encode::HanExtra -- More Chinese via CPANDue to the size concerns, additional Chinese encodings below aredistributed separately on CPAN, under the name Encode::HanExtra. Standard DOS/Win Macintosh Comment/Reference ---------------------------------------------------------------- big5ext CMEX's Big5e Extension big5plus CMEX's Big5+ Extension cccii Chinese Character Code for Information Interchange euc-tw EUC (Extended Unix Character) gb18030 GBK with Traditional Characters ----------------------------------------------------------------=item Encode::JIS2K -- JIS X 0213 encodings via CPANDue to size concerns, additional Japanese encodings below aredistributed separately on CPAN, under the name Encode::JIS2K. Standard DOS/Win Macintosh Comment/Reference ---------------------------------------------------------------- euc-jisx0213 shiftjisx0123 iso-2022-jp-3 jis0213-1-raw jis0213-2-raw ----------------------------------------------------------------=back=head2 Miscellaneous encodings=over 2=item Encode::EBCDICSee L<perlebcdic> for details. ---------------------------------------------------------------- cp37 cp500 cp875 cp1026 cp1047 posix-bc ----------------------------------------------------------------=item Encode::SymbolsFor symbols and dingbats. ---------------------------------------------------------------- symbol dingbats MacDingbats AdobeZdingbat AdobeSymbol ----------------------------------------------------------------=item Encode::MIME::HeaderStrictly speaking, MIME header encoding documented in RFC 2047 is moreof encapsulation than encoding. However, their support in modernworld is imperative so they are supported. ---------------------------------------------------------------- MIME-Header [RFC2047] MIME-B [RFC2047] MIME-Q [RFC2047] ----------------------------------------------------------------=item Encode::GuessThis one is not a name of encoding but a utility that lets you pick upthe most appropriate encoding for a data out of given I<suspects>. SeeL<Encode::Guess> for details.=back=head1 Unsupported encodingsThe following encodings are not supported as yet; some because theyare rarely used, some because of technical difficulties. They maybe supported by external modules via CPAN in the future, however.=over 2=item ISO-2022-JP-2 [RFC1554]Not very popular yet. Needs Unicode Database or equivalent toimplement encode() (because it includes JIS X 0208/0212, KSC5601, andGB2312 simultaneously, whose code points in Unicode overlap. So youneed to lookup the database to determine to what character set a givenUnicode character should belong). =item ISO-2022-CN [RFC1922]Not very popular. Needs CNS 11643-1 and -2 which are not available inthis module. CNS 11643 is supported (via euc-tw) in Encode::HanExtra.Autrijus Tang may add support for this encoding in his module in future.=item Various HP-UX encodingsThe following are unsupported due to the lack of mapping data. '8' - arabic8, greek8, hebrew8, kana8, thai8, and turkish8 '15' - japanese15, korean15, and roi15=item Cyrillic encoding ISO-IR-111Anton Tagunov doubts its usefulness.=item ISO-8859-8-1 [Hebrew]None of the Encode team knows Hebrew enough (ISO-8859-8, cp1255 andMacHebrew are supported because and just because there were mappingsavailable at L<http://www.unicode.org/>). Contributions welcome.=item ISIRI 3342, Iran System, ISIRI 2900 [Farsi]Ditto.=item Thai encoding TCVNDitto.=item Vietnamese encodings VPSThough Jungshik Shin has reported that Mozilla supports this encoding,it was too late before 5.8.0 for us to add it. In the future, itmay be available via a separate module. SeeL<http://lxr.mozilla.org/seamonkey/source/intl/uconv/ucvlatin/vps.uf>andL<http://lxr.mozilla.org/seamonkey/source/intl/uconv/ucvlatin/vps.ut>if you are interested in helping us.=item Various Mac encodingsThe following are unsupported due to the lack of mapping data. MacArmenian, MacBengali, MacBurmese, MacEthiopic MacExtArabic, MacGeorgian, MacKannada, MacKhmer MacLaotian, MacMalayalam, MacMongolian, MacOriya MacSinhalese, MacTamil, MacTelugu, MacTibetan MacVietnameseThe rest which are already available are based upon the vendor mappingsat L<http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/> .=item (Mac) Indic encodingsThe maps for the following are available at L<http://www.unicode.org/>but remain unsupport because those encodings need algorithmicalapproach, currently unsupported by F<enc2xs>: MacDevanagari MacGurmukhi MacGujaratiFor details, please see C<Unicode mapping issues and notes:> atL<http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/DEVANAGA.TXT> .I believe this issue is prevalent not only for Mac Indics but also inother Indic encodings, but the above were the only Indic encodingsmaps that I could find at L<http://www.unicode.org/> .=back=head1 Encoding vs. Charset -- terminologyWe are used to using the term (character) I<encoding> and I<characterset> interchangeably. But just as confusing the terms byte andcharacter is dangerous and the terms should be differentiated whenneeded, we need to differentiate I<encoding> and I<character set>.To understand that, here is a description of how we make computersgrok our characters.=over 2=item *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -