perldoc > Encode::Supported

🏷️ NAME

Encode::Supported — Encodings supported by Encode

🚀 Quick Reference

Use CaseCommandDescription
Encode a string to UTF-8use Encode; $utf8 = encode('UTF-8', $string);Converts $string to UTF-8
Decode from UTF-8use Encode; $string = decode('UTF-8', $utf8);Converts UTF-8 bytes back to Perl string
List all supported encodingsuse Encode; @encodings = Encode->encodings();Returns list of all encoding names
Find encoding aliasEncode::resolve_alias('latin1');Returns canonical name 'iso-8859-1'
Detect encoding from dataEncode::Guess->guess($data);Attempts to guess encoding from suspects
Encode for MIME headerencode('MIME-Header', $subject);Encodes string for email headers (RFC 2047)

📖 DESCRIPTION

🏷️ Encoding Names

Encoding names are case insensitive. White space in names is 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 picking the first in the following sequence (with a few exceptions).

In case de jure canonical names differ from that of the Encode module, they are always aliased if it ever be implemented. So you can safely 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.

📚 Supported Encodings

As 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 modules but you don't have to "use Encode::XX" to make them available for most cases. Encode.pm will automatically load those modules on demand.

🔧 Built-in Encodings

The following encodings are always available.

CanonicalAliasesComments & References
asciiUS-ascii ISO-646-USECMA
ascii-ctrlSpecial Encoding
iso-8859-1latin1ISO
nullSpecial Encoding
utf8UTF-8RFC2279

null and ascii-ctrl are special. "null" fails for all character so when you set fallback mode to PERLQQ, HTMLCREF or XMLCREF, ALL CHARACTERS will fall back to character references. Ditto for "ascii-ctrl" except for control characters. For fallback modes, see Encode.

🌐 Encode::Unicode — other Unicode encodings

Encode::Unicode

Unicode coding schemes other than native utf8 are supported by Encode::Unicode, which will be autoloaded on demand.

CanonicalAliasesReferences
UCS-2BEUCS-2, iso-10646-1IANA, UC
UCS-2LEUC
UTF-16UC
UTF-16BEUC
UTF-16LEUC
UTF-32UC
UTF-32BEUCS-4UC
UTF-32LEUC
UTF-7RFC2152

To find how (UCS-2|UTF-(16|32))(LE|BE)? differ from one another, see Encode::Unicode.

UTF-7 is a special encoding which "re-encodes" UTF-16BE into a 7-bit encoding. It is implemented separately by Encode::Unicode::UTF7.

📄 Encode::Byte — Extended ASCII

Encode::Byte

Encode::Byte implements most single-byte encodings except for Symbols and EBCDIC. The following encodings are based on single-byte encodings implemented as extended ASCII. Most of them map \x80-\xff (upper half) to non-ASCII characters.

ISO-8859 and corresponding vendor mappings

Since there are so many, they are presented in table format with languages and corresponding encoding names by vendors. Note that the table is sorted in order of ISO-8859 and the corresponding vendor mappings are slightly different from that of ISO. See http://czyborra.com/charsets/iso8859.html for details.

Lang/RegionsISO/Other Std.DOSWindowsMacintoshOthers
N. America(ASCII)cp437AdobeStandardEncoding
cp863 (DOSCanadaF)
W. Europeiso-8859-1cp850cp1252MacRomannextstep, hp-roman8
cp860 (DOSPortuguese)
Cntrl. Europeiso-8859-2cp852cp1250MacCentralEurRoman, MacCroatian, MacRomanian, MacRumanian
Latin3[1]iso-8859-3
Latin4[2]iso-8859-4
Cyrillicsiso-8859-5cp855, cp866cp1251MacCyrillic, MacUkrainian
Arabiciso-8859-6cp864, cp1006cp1256MacArabic, MacFarsi
Greekiso-8859-7cp737, cp869 (DOSGreek2)cp1253MacGreek
Hebrewiso-8859-8cp862cp1255MacHebrew
Turkishiso-8859-9cp857cp1254MacTurkish
Nordicsiso-8859-10cp865, cp861MacIcelandic, MacSami
Thaiiso-8859-11[3]cp874MacThai
Balticsiso-8859-13cp775cp1257
Celticsiso-8859-14
Latin9 [4]iso-8859-15
Latin10iso-8859-16
Vietnamesevisciicp1258MacVietnamese
  1. [1] Esperanto, Maltese, and Turkish. Turkish is now on 8859-9.
  2. [2] Baltics. Now on 8859-10, except for Latvian.
  3. [3] TIS 620 + Non-Breaking Space (0xA0 / U+00A0)
  4. [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 also http://czyborra.com/charsets/codepages.html.

Macintosh encodings don't seem to be registered in such entities as IANA. "Canonical" names in Encode are based upon Apple's Tech Note 1150. See http://developer.apple.com/technotes/tn/tn1150.html for details.

KOI8 - De Facto Standard for the Cyrillic world

Though ISO-8859 does have ISO-8859-5, the KOI8 series is far more popular in the Net. Encode comes with the following KOI charsets. For gory details, see http://czyborra.com/charsets/cyrillic.html

CanonicalAliasesReferences
koi8-f
koi8-rcp878RFC1489
koi8-uRFC2319

📱 GSM 0338 - Hentai Latin 1

GSM0338 is for GSM handsets. Though it shares alphanumerals with ASCII, control character ranges and other parts are mapped very differently, mainly to store Greek characters. There are also escape sequences (starting with 0x1B) to cover e.g. the Euro sign.

This was once handled by Encode::Bytes but because of all those unusual specifications, Encode 2.20 has relocated the support to Encode::GSM0338. See Encode::GSM0338 for details.

gsm0338 support before 2.19

Some special cases like a trailing 0x00 byte or a lone 0x1B byte are not well-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 the reuse of Latin capital letters as Greek capital letters (for example, the 0x5A is U+005A (LATIN CAPITAL LETTER Z), not U+0396 (GREEK CAPITAL LETTER ZETA).

The GSM0338 is also covered in Encode::Byte even though it is not an "extended ASCII" encoding.

🌏 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 by countries, due to the size concerns (simplified Chinese is mapped to 'CN', continental China, while traditional Chinese is mapped to 'TW', Taiwan). Please refer to their respective documentation pages.

🇨🇳 Encode::CN — Continental China
Encode::CN
StandardDOS/WinMacintoshComment/Reference
euc-cn [1]MacChineseSimp
(gbk)cp936 [2]
gb12345-raw{ GB12345 without CES }
gb2312-raw{ GB2312 without CES }
hz
iso-ir-165
  1. [1] GB2312 is aliased to this. See Microsoft-related naming mess
  2. [2] gbk is aliased to this. See Microsoft-related naming mess
🇯🇵 Encode::JP — Japan
Encode::JP
StandardDOS/WinMacintoshComment/Reference
euc-jp
shiftjiscp932macJapanese
7bit-jis
iso-2022-jpRFC1468
iso-2022-jp-1RFC2237
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 }
🇰🇷 Encode::KR — Korea
Encode::KR
StandardDOS/WinMacintoshComment/Reference
euc-krMacKoreanRFC1557
cp949 [1]
iso-2022-krRFC1557
johab[KS X 1001:1998, Annex 3]
ksc5601-raw{ KSC5601 without CES }
  1. [1] ks_c_5601-1987, (x-)?windows-949, and uhc are aliased to this. See below.
🇹🇼 Encode::TW — Taiwan
Encode::TW
StandardDOS/WinMacintoshComment/Reference
big5-etencp950MacChineseTrad{big5 aliased to big5-eten}
big5-hkscs
🇨🇳 Encode::HanExtra — More Chinese via CPAN
Encode::HanExtra

Due to the size concerns, additional Chinese encodings below are distributed separately on CPAN, under the name Encode::HanExtra.

StandardDOS/WinMacintoshComment/Reference
big5extCMEX's Big5e Extension
big5plusCMEX's Big5+ Extension
ccciiChinese Character Code for Information Interchange
euc-twEUC (Extended Unix Character)
gb18030GBK with Traditional Characters
🇯🇵 Encode::JIS2K — JIS X 0213 encodings via CPAN
Encode::JIS2K

Due to size concerns, additional Japanese encodings below are distributed separately on CPAN, under the name Encode::JIS2K.

StandardDOS/WinMacintoshComment/Reference
euc-jisx0213
shiftjisx0123
iso-2022-jp-3
jis0213-1-raw
jis0213-2-raw

🧩 Miscellaneous encodings

🔍 Encode::EBCDIC
Encode::EBCDIC

See perlebcdic for details.

Encoding
cp37
cp500
cp875
cp1026
cp1047
posix-bc
🔣 Encode::Symbols
Encode::Symbols

For symbols and dingbats.

Encoding
symbol
dingbats
MacDingbats
AdobeZdingbat
AdobeSymbol
📧 Encode::MIME::Header
Encode::MIME::Header

Strictly speaking, MIME header encoding documented in RFC 2047 is more of encapsulation than encoding. However, their support in modern world is imperative so they are supported.

EncodingReference
MIME-HeaderRFC2047
MIME-BRFC2047
MIME-QRFC2047
🔮 Encode::Guess
Encode::Guess

This one is not a name of encoding but a utility that lets you pick up the most appropriate encoding for a data out of given suspects. See Encode::Guess for details.

❌ Unsupported Encodings

The following encodings are not supported as yet; some because they are rarely used, some because of technical difficulties. They may be supported by external modules via CPAN in the future, however.

📐 Encoding vs. Charset — terminology

We are used to using the term (character) encoding and character set interchangeably. But just as confusing the terms byte and character is dangerous, we need to differentiate encoding and character set.

To understand that, here is a description of how we make computers grok our characters.

Technically, or mathematically, speaking, a character set encoded in such a CES that maps character by character may form a CCS. EUC is such an example. The CES of EUC is as follows:

By carefully looking at the encoded byte sequence, you can find that the byte sequence conforms a unique number. In that sense, EUC is a CCS generated by a CES above from up to four CCS (complicated?). UTF-8 falls into this category. See "UTF-8" in perlUnicode to find out how UTF-8 maps Unicode to a byte sequence.

You may also have found out by now why 7bit ISO-2022 cannot comprise a CCS. If you look at a byte sequence \x21\x21, you can't tell if it is two !'s or IDEOGRAPHIC SPACE. EUC maps the latter to \xA1\xA1 so you have no trouble differentiating between "!!". and " ".

🗂️ Encoding Classification

This section tries to classify the supported encodings by their applicability for information exchange over the Internet and to choose the most suitable aliases to name them in the context of such communication.

Encoding names

US-ASCII, UTF-8, ISO-8859-*, KOI8-R, Shift_JIS, EUC-JP, ISO-2022-JP, ISO-2022-JP-1, EUC-KR, Big5, GB2312 are registered with IANA as preferred MIME names and may be used over the Internet.

"Shift_JIS" has been officialized by JIS X 0208:1997. "Microsoft-related naming mess" gives details.

"GB2312" is the IANA name for "EUC-CN". See "Microsoft-related naming mess" for details.

"GB_2312-80" raw encoding is available as "gb2312-raw" with Encode. See Encode::CN for details.

EUC-CN, KOI8-U [RFC2319] have not been registered with IANA (as of March 2002) but seem to be supported by major web browsers. The IANA name for "EUC-CN" is "GB2312".

KS_C_5601-1987 is heavily misused. See "Microsoft-related naming mess" for details.

"KS_C_5601-1987" raw encoding is available as "kcs5601-raw" with Encode. See Encode::KR for details.

UTF-16, UTF-16BE, UTF-16LE are IANA-registered "charset"s. See RFC 2781 for details. Jungshik Shin reports that UTF-16 with a BOM is well accepted by MS IE 5/6 and NS 4/6. Beware however that:

The rule of thumb is to use "UTF-8" unless you know what you're doing and unless you really benefit from using "UTF-16".

ISO-IR-165 [RFC1345], VISCII, GB 12345, GB 18030 (**), EUC-TW (**) are totally valid encodings but not registered at IANA. The names under which they are listed here are probably the most widely-known names for these encodings and are recommended names.

BIG5PLUS (**) is a proprietary name.

🏢 Microsoft-related naming mess

Microsoft products misuse the following names:

📖 Glossary

character repertoire A collection of unique characters. A character set in the strictest sense. At this stage, characters are not numbered. coded character set (CCS) A character set that is mapped in a way computers can use directly. Many character encodings, including EUC, fall in this category. character encoding scheme (CES) An algorithm to map a character set to a byte sequence. You don't have to be able to tell which character set a given byte sequence belongs. 7-bit ISO-2022 is a CES but it cannot be a CCS. EUC is an example of being both a CCS and CES. charset (in MIME context) has long been used in the meaning of "encoding", CES. While the word combination "character set" has lost this meaning in MIME context since RFC 2130, the "charset" abbreviation has retained it. This is how RFC 2277 and RFC 2278 bless "charset". EUC Extended Unix Character. See ISO-2022. ISO-2022 A CES that was carefully designed to coexist with ASCII. There are a 7 bit version and an 8 bit version. The 7 bit version switches character set via escape sequence so it cannot form a CCS. Since this is more difficult to handle in programs than the 8 bit version, the 7 bit version is not very popular except for iso-2022-jp, the de facto standard CES for e-mails. The 8 bit version can form a CCS. EUC and ISO-8859 are two examples thereof. Pre-5.6 perl could use them as string literals. UCS Short for Universal Character Set. When you say just UCS, it means Unicode. UCS-2 ISO/IEC 10646 encoding form: Universal Character Set coded in two octets. Unicode A character set that aims to include all character repertoires of the world. Many character sets in various national as well as industrial standards have become, in a way, just subsets of Unicode. UTF Short for Unicode Transformation Format. Determines how to map a Unicode character into a byte sequence. UTF-16 A UTF in 16-bit encoding. Can either be in big endian or little endian. The big endian version is called UTF-16BE (equal to UCS-2 + surrogate support) and the little endian version is called UTF-16LE.

🔗 See Also

Encode, Encode::Byte, Encode::CN, Encode::JP, Encode::KR, Encode::TW, Encode::EBCDIC, Encode::Symbol, Encode::MIME::Header, Encode::Guess

📚 References

🌐 Other Notable Sites

📚 Offline sources

Encode::Supported
🏷️ NAME 🚀 Quick Reference 📖 DESCRIPTION
🏷️ Encoding Names 📚 Supported Encodings ❌ Unsupported Encodings 📐 Encoding vs. Charset — terminology 🗂️ Encoding Classification 📖 Glossary
🔗 See Also 📚 References
🌐 Other Notable Sites 📚 Offline sources

Generated by phpman v4.9.26-5-g7740029 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-11 01:33 @216.73.216.11
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^