Commit | Line | Data |
0e567a6c |
1 | package Encode::JP; |
d1256cb1 |
2 | |
0f3b375a |
3 | BEGIN { |
d1256cb1 |
4 | if ( ord("A") == 193 ) { |
5 | die "Encode::JP not supported on EBCDIC\n"; |
0f3b375a |
6 | } |
7 | } |
0e567a6c |
8 | use Encode; |
d1256cb1 |
9 | our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; |
ee981de6 |
10 | |
0e567a6c |
11 | use XSLoader; |
d1256cb1 |
12 | XSLoader::load( __PACKAGE__, $VERSION ); |
0e567a6c |
13 | |
aae85ceb |
14 | use Encode::JP::JIS7; |
0e567a6c |
15 | |
16 | 1; |
17 | __END__ |
67d7b5ef |
18 | |
557e5ea9 |
19 | =head1 NAME |
20 | |
21 | Encode::JP - Japanese Encodings |
22 | |
23 | =head1 SYNOPSIS |
24 | |
1b2c56c8 |
25 | use Encode qw/encode decode/; |
2b217bf7 |
26 | $euc_jp = encode("euc-jp", $utf8); # loads Encode::JP implicitly |
ee981de6 |
27 | $utf8 = decode("euc-jp", $euc_jp); # ditto |
557e5ea9 |
28 | |
29 | =head1 ABSTRACT |
30 | |
31 | This module implements Japanese charset encodings. Encodings |
32 | supported are as follows. |
33 | |
fab31126 |
34 | Canonical Alias Description |
35 | -------------------------------------------------------------------- |
67d7b5ef |
36 | euc-jp /\beuc.*jp$/i EUC (Extended Unix Character) |
37 | /\bjp.*euc/i |
d1256cb1 |
38 | /\bujis$/i |
67d7b5ef |
39 | shiftjis /\bshift.*jis$/i Shift JIS (aka MS Kanji) |
d1256cb1 |
40 | /\bsjis$/i |
67d7b5ef |
41 | 7bit-jis /\bjis$/i 7bit JIS |
42 | iso-2022-jp ISO-2022-JP [RFC1468] |
d1256cb1 |
43 | = 7bit JIS with all Halfwidth Kana |
44 | converted to Fullwidth |
67d7b5ef |
45 | iso-2022-jp-1 ISO-2022-JP-1 [RFC2237] |
a999c27c |
46 | = ISO-2022-JP with JIS X 0212-1990 |
d1256cb1 |
47 | support. See below |
a999c27c |
48 | MacJapanese Shift JIS + Apple vendor mappings |
8f1ed24a |
49 | cp932 /\bwindows-31j$/i Code Page 932 |
a999c27c |
50 | = Shift JIS + MS/IBM vendor mappings |
f2a2953c |
51 | jis0201-raw JIS0201, raw format |
52 | jis0208-raw JIS0201, raw format |
53 | jis0212-raw JIS0201, raw format |
5129552c |
54 | -------------------------------------------------------------------- |
557e5ea9 |
55 | |
56 | =head1 DESCRIPTION |
57 | |
0ab8f81e |
58 | To find out how to use this module in detail, see L<Encode>. |
557e5ea9 |
59 | |
a63c962f |
60 | =head1 Note on ISO-2022-JP(-1)? |
61 | |
62 | ISO-2022-JP-1 (RFC2237) is a superset of ISO-2022-JP (RFC1468) which |
63 | adds support for JIS X 0212-1990. That means you can use the same |
64 | code to decode to utf8 but not vice versa. |
65 | |
66 | $utf8 = decode('iso-2022-jp-1', $stream); |
0ab8f81e |
67 | |
68 | and |
69 | |
a63c962f |
70 | $utf8 = decode('iso-2022-jp', $stream); |
71 | |
0ab8f81e |
72 | yield the same result but |
a63c962f |
73 | |
74 | $with_0212 = encode('iso-2022-jp-1', $utf8); |
75 | |
76 | is now different from |
77 | |
78 | $without_0212 = encode('iso-2022-jp', $utf8 ); |
79 | |
0ab8f81e |
80 | In the latter case, characters that map to 0212 are first converted |
81 | to U+3013 (0xA2AE in EUC-JP; a white square also known as 'Tofu' or |
82 | 'geta mark') then fed to the decoding engine. U+FFFD is not used, |
83 | in order to preserve text layout as much as possible. |
a63c962f |
84 | |
557e5ea9 |
85 | =head1 BUGS |
86 | |
0ab8f81e |
87 | The ASCII region (0x00-0x7f) is preserved for all encodings, even |
88 | though this conflicts with mappings by the Unicode Consortium. See |
557e5ea9 |
89 | |
a63c962f |
90 | L<http://www.debian.or.jp/~kubota/unicode-symbols.html.en> |
557e5ea9 |
91 | |
0ab8f81e |
92 | to find out why it is implemented that way. |
557e5ea9 |
93 | |
94 | =head1 SEE ALSO |
95 | |
85982a32 |
96 | L<Encode> |
557e5ea9 |
97 | |
98 | =cut |