4 die "Encode::JP not supported on EBCDIC\n";
8 our $VERSION = do { my @r = (q$Revision: 1.0 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
11 XSLoader::load('Encode::JP',$VERSION);
14 use Encode::JP::2022_JP;
15 use Encode::JP::2022_JP1;
22 Encode::JP - Japanese Encodings
26 use Encode qw/encode decode/;
27 $euc_jp = encode("euc-jp", $utf8); # loads Encode::JP implicitly
28 $utf8 = decode("euc-jp", $euc_jp); # ditto
32 This module implements Japanese charset encodings. Encodings
33 supported are as follows.
35 Canonical Alias Description
36 --------------------------------------------------------------------
37 euc-jp /\beuc.*jp$/i EUC (Extended Unix Character)
40 shiftjis /\bshift.*jis$/i Shift JIS (aka MS Kanji)
42 7bit-jis /\bjis$/i 7bit JIS
43 iso-2022-jp ISO-2022-JP [RFC1468]
44 (7bit JIS with all Halfwidth Kana
45 converted to Fullwidth)
46 iso-2022-jp-1 ISO-2022-JP-1 [RFC2237]
47 (ISO-2022-JP with JIS X 0212-1990
49 MacJapanese (Shift JIS + Apple vendor mappings)
51 (Shift JIS + MS/IBM vendor mappings)
52 --------------------------------------------------------------------
56 To find how to use this module in detail, see L<Encode>.
58 =head1 Note on ISO-2022-JP(-1)?
60 ISO-2022-JP-1 (RFC2237) is a superset of ISO-2022-JP (RFC1468) which
61 adds support for JIS X 0212-1990. That means you can use the same
62 code to decode to utf8 but not vice versa.
64 $utf8 = decode('iso-2022-jp-1', $stream);
65 $utf8 = decode('iso-2022-jp', $stream);
67 Yields the same result but
69 $with_0212 = encode('iso-2022-jp-1', $utf8);
73 $without_0212 = encode('iso-2022-jp', $utf8 );
75 In the latter case, characters that map to 0212 are at first converted
76 to U+3013 (0xA2AE in EUC-JP; a white square also known as 'Tofu') then
77 fed to decoding engine. U+FFFD is not used to preserve text layout as
82 ASCII part (0x00-0x7f) is preserved for all encodings, even though it
83 conflicts with mappings by the Unicode Consortium. See
85 L<http://www.debian.or.jp/~kubota/unicode-symbols.html.en>
87 to find why it is implemented that way.
91 L<Encode>,L<Encode::CJKguide>