/[suikacvs]/test/oldencodeutils/lib/Encode/SJIS/JIS.pm
Suika

Contents of /test/oldencodeutils/lib/Encode/SJIS/JIS.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sat Oct 12 11:02:38 2002 UTC (23 years, 6 months ago) by wakaba
Branch: MAIN
2002-10-12  Nanashi-san

	* JIS.pm: New module.
	(Commited by Wakaba <w@suika.fam.cx>)

1
2 =head1 NAME
3
4 Encode::SJIS::JIS --- Encoder/decoder of standard Shift JIS coding systems
5
6 =head1 ENCODINGS
7
8 =over 4
9
10 =cut
11
12 package Encode::SJIS::JIS;
13 use strict;
14 our $VERSION=do{my @r=(q$Revision: 1.1 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
15 require Encode::SJIS;
16 require Encode::Encoding;
17
18 package Encode::SJIS::JIS::SJIS1997;
19 use base 'Encode::SJIS';
20 __PACKAGE__->Define (qw!shift-jis-1997 shift_jis csshiftjis japanese-shift-jis!);
21
22 =item shift-jis-1997
23
24 Shift coded representation defined by JIS X 0208:1997 Appendix 1.
25 (Alias: shift_jis (IANA), csshiftjis (IANA), japanese-shift-jis (emacsen))
26
27 Note that although IANA registry [IANAREG] associates the name "MS_Kanji"
28 as an alias of "Shift_JIS", in this module it is not used as
29 a name of Shift coded representation of JIS X 0208,
30 since it is more apropreate to associate the name with
31 Microsoft-defined-Shift-JIS. (Microsoft's shift JIS is
32 superset of JIS X 0208's shift JIS, even Microsoft's
33 does NOT comform to JIS X 0208:1997.)
34
35 =cut
36
37 sub __2022__common ($) {
38 my $C = Encode::SJIS->new_object;
39 $C->{G0} = $Encode::Charset::CHARSET{G94}->{J}; ## JIS X 0201:1997 Latin
40 $C->{G1} = $Encode::Charset::CHARSET{G94n}->{'B@'}; ## JIS X 0208:1997
41 $C->{G2} = $Encode::Charset::CHARSET{G94}->{I}; ## JIS X 0201:1997 Katakana
42 $C->{G3} = $Encode::Charset::CHARSET{G94n}->{' @'}; ## undef
43 $C;
44 }
45 sub __encode_map ($) {
46 [qw/ucs_to_jisx0201_latin ucs_to_jisx0208_1997 ucs_to_jisx0201_katakana/];
47 }
48 sub __decode_map ($) {
49 [qw/jisx0201_latin_to_ucs jisx0208_1997_to_ucs jisx0201_katakana_to_ucs/];
50 }
51
52 package Encode::SJIS::JIS::SJIS1997ASCII;
53 use base 'Encode::SJIS::JIS::SJIS1997';
54 __PACKAGE__->Define (qw/shift-jis-1997-ascii/);
55
56 =item shift-jis-1997-ascii
57
58 Same as Shift_JISX0213 but ASCII (ISO/IEC 646 IRV)
59 instead of JIS X 0201:1997 Latin character set.
60
61 Note that this coding system does NOT comform to
62 JIS X 0208:1997 Appendix 1.
63
64 =cut
65
66 sub __2022__common ($) {
67 my $C = shift->SUPER::__2022__common;
68 $C->{G0} = $Encode::Charset::CHARSET{G94}->{B}; ## ASCII
69 $C;
70 }
71 sub __encode_map ($) {
72 [qw/ucs_to_ascii ucs_to_jisx0208_1997 ucs_to_jisx0201_katakana/];
73 }
74 sub __decode_map ($) {
75 [qw/jisx0208_1997_to_ucs jisx0201_katakana_to_ucs/];
76 }
77
78 package Encode::SJIS::JIS::SJIS2000plane1;
79 use base 'Encode::SJIS';
80 __PACKAGE__->Define (qw!shift_jisx0213-plane1!);
81
82 =item shift_jisx0213-plane1
83
84 Shift_JISX0213-plane1 coded representation defined by JIS X 0213:2000
85 Appendix 1 (i.e. implemention level 3).
86
87 =cut
88
89 sub __2022_encode ($) {
90 my $C = shift->__2022__common;
91 $C->{G3} = $Encode::Charset::CHARSET{G94n}->{' @'}; ## undef
92 $C;
93 }
94 sub __encode_map ($) {
95 [qw/ucs_to_jisx0201_latin ucs_to_jisx0213_2000_1 ucs_to_jisx0201_katakana/];
96 }
97
98 1;
99 __END__
100
101 =back
102
103 Coding systems C<shift_jisx0213> and C<shift_jisx0213-ascii>
104 are defined in Encode::SJIS.
105
106 Shift JISes using alternative name (so mapped to HALFWIDTH
107 or FULLWIDTH area of UCS) defined by JIS X 0208:1997 or
108 JIS X 0213:2000 are not included in this module but in
109 Encode::SJIS::JISCompatible.
110
111 Shift JISes with JIS X 0208-1978, -1983, -1990 are not
112 included in this module since these standards did not
113 define them. They are defined in Encode::SJIS::*
114 other than this module.
115
116 =head1 SEE ALSO
117
118 JIS X 0208:1997, "7-bit and 8-bit double byte coded Kanji
119 set for information interchange", Japan Industrial Standards
120 Committee (JISC) <http://www.jisc.go.jp/>, 1997.
121
122 JIS X 0213:2000, "7-bit and 8-bit double byte coded extended Kanji
123 sets for information interchange", Japan Industrial Standards
124 Committee (JISC) <http://www.jisc.go.jp/>, 2000.
125
126 Encode::SJIS
127
128 [IANAREG] "CHARACTER SETS", IANA <http://www.iana.org/>,
129 <http://www.iana.org/assignments/character-sets>.
130 The charset registry for IETF <http://www.ietf.org/> standards.
131
132 =head1 LICENSE
133
134 Copyright 2002 Nanashi-san
135
136 This library is free software; you can redistribute it
137 and/or modify it under the same terms as Perl itself.
138
139 =cut
140
141 # $Date: 2002/10/12 07:27:01 $
142 ### SJIS.pm ends here

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24