Encode::JP(3perl)
π Encode::JP π
okay bestie, so this is the Encode::JP page from the Perl Programmers Reference Guide β it's the module that handles Japanese encodings and honestly? it's a whole vibe. let's get into it β¨
πΈ NAME πΈ
Encode::JP β Japanese Encodings. yes that's the whole thing. it does what it says on the tin, queen π
β¨ SYNOPSIS β¨
here's the whole entire vibe, bestie:
use Encode qw/encode decode/;
$euc_jp = encode("euc-jp", $utf8); # loads Encode::JP implicitly
$utf8 = decode("euc-jp", $euc_jp); # ditto
see how you didn't even have to ask for it? Encode::JP just shows up. main character energy fr π
π ABSTRACT π
so this module implements Japanese charset encodings, and the whole roster is as follows. no cap, here's everybody:
euc-jpβ aliases:/\beuc.*jp$/i,/\bjp.*euc/i,/\bujis$/iβ this one's EUC (Extended Unix Character) π¦shiftjisβ aliases:/\bshift.*jis$/i,/\bsjis$/iβ Shift JIS, aka MS Kanji β¨7bit-jisβ alias:/\bjis$/iβ 7bit JISiso-2022-jpβ no aliases, it's just ISO-2022-JP[RFC1468], which is = 7bit JIS with all Halfwidth Kana converted to Fullwidth πiso-2022-jp-1β ISO-2022-JP-1[RFC2237]= ISO-2022-JP with JIS X 0212-1990 support. See below πMacJapaneseβ Shift JIS + Apple vendor mappings πcp932β alias:/\bwindows-31j$/iβ Code Page 932 = Shift JIS + MS/IBM vendor mappings πͺjis0201-rawβ JIS0201, raw formatjis0208-rawβ JIS0208, raw formatjis0212-rawβ JIS0212, raw format
and that's the entire lineup, periodt π
π DESCRIPTION π
ngl if you wanna find out how to use this module in detail, go read Encode. that's the actual full manual, this one's just the Japanese-flavored chapter π«Ά
π Note on ISO-2022-JP(-1)? π
okay so this is the part where it gets a little spicy π₯
ISO-2022-JP-1 (RFC2237) is a superset of ISO-2022-JP (RFC1468), and what it adds is support for JIS X 0212-1990. what that means for you is: you can run the same code to decode to utf8, but not the other way around. so like:
$utf8 = decode('iso-2022-jp-1', $stream);
and
$utf8 = decode('iso-2022-jp', $stream);
both give you the exact same result, bestie. same output, no diff. but then:
$with_0212 = encode('iso-2022-jp-1', $utf8);
is now different from
$without_0212 = encode('iso-2022-jp', $utf8 );
and in that latter case β the iso-2022-jp one β any characters that map to 0212 get converted first to U+3013 (0xA2AE in EUC-JP; that's a white square, also known as 'Tofu' or 'geta mark' β yes the tofu has a whole nickname π) and then handed off to the decoding engine.
and lowkey important: U+FFFD is not used here, because the goal is to preserve the text layout as much as possible. so if you were expecting the classic replacement char, bestie... you're not getting it π
π BUGS π
heads up: the ASCII region (0x00-0x7f) is preserved for all encodings, even though that conflicts with mappings by the Unicode Consortium. so yeah. it is what it is β documented, known, and still shipped π
π SEE ALSO π
Encode
and that's the whole page, bestie π this was Encode::JP(3perl) from the Perl Programmers Reference Guide, perl v5.44.0, dated 2026-10-17. go slay some charset conversions, you've totally got this π¦β¨π
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms