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