Encode::CN(3pm)

πŸ“¦
version 5.42.3 Β· 4 versions
, in alpine 3.24

hey bestie πŸ’– you just opened Encode::CN(3pm) from the Perl Programmers Reference Guide, and it’s giving China-based Chinese encodings in the cutest possible way. no cap, every single detail is staying. 🫢

🌸 NAME 🌸

Encode::CN β€” China-based Chinese Encodings ✨

✨ SYNOPSIS ✨

okay so the vibe check is: you load Encode, then encode/decode like this:

use Encode qw/encode decode/;
$euc_cn = encode("euc-cn", $utf8);   # loads Encode::CN implicitly
$utf8   = decode("euc-cn", $euc_cn); # ditto

the first call loads Encode::CN implicitly, and the second one is ditto β€” literally what the comments say. πŸ’…

πŸ’… DESCRIPTION πŸ’…

this module implements China-based Chinese charset encodings. here are the supported encodings, with canonical name, alias, and description all accounted for:

  • euc-cn β€” aliases: /\beuc.*cn$/i, /\bcn.*euc$/i, /\bGB[-_ ]?2312(?:\D.*$|$)/i (see below). description: EUC (Extended Unix Character). πŸ’–
  • gb2312-raw β€” no alias listed in the table. description: The raw (low-bit) GB2312 character map.
  • gb12345-raw β€” no alias listed in the table. description: Traditional chinese counterpart to GB2312 (raw).
  • iso-ir-165 β€” no alias listed in the table. description: GB2312 + GB6345 + GB8565 + additions.
  • MacChineseSimp β€” no alias listed in the table. description: GB2312 + Apple Additions.
  • cp936 β€” no alias listed in the table. description: Code Page 936, also known as GBK (Extended GuoBiao).
  • hz β€” no alias listed in the table. description: 7-bit escaped GB2312 encoding.

to find how to use this module in detail, see Encode. πŸ¦‹

πŸ“ NOTES πŸ“

due to size concerns, "GB 18030" (an extension to "GBK") is distributed separately on CPAN, under the name Encode::HanExtra. that module also contains extra Taiwan-based encodings. πŸ’œ

πŸ’€ BUGS πŸ’€

when you see charset=gb2312 on mails and web pages, they really mean euc-cn encodings β€” yes, for real. to fix that, gb2312 is aliased to euc-cn. use gb2312-raw when you really mean it. πŸ™ˆ

the ASCII region (0x00-0x7f) is preserved for all encodings, even though this conflicts with mappings by the Unicode Consortium. ⚠️

πŸ‘€ SEE ALSO πŸ‘€

Encode β€” that’s the one. go read it, bestie. 🫢


okay that’s the whole page, periodt πŸ’… kisses from source/version perl v5.42.3, dated 2026-11-03, and this was the Encode::CN(3pm) manual. πŸŽ€πŸ”₯

πŸ“¦ where this page comes from