/[pub]/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.2 - (hide annotations) (download)
Mon Oct 14 06:58:35 2002 UTC (23 years, 3 months ago) by wakaba
Branch: MAIN
Changes since 1.1: +12 -2 lines
2002-10-14  Nanashi-san

	* ISO2022.pm, SJIS.pm: Bug fix of utf8 flag control.
	(Committed by Wakaba <w@suika.fam.cx>.)

1 wakaba 1.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 wakaba 1.2 __PACKAGE__->Define (qw/shift-jis-1997-ascii shift_jis-ascii/);
55 wakaba 1.1
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 wakaba 1.2 (Alias: shift_jis-ascii)
61 wakaba 1.1
62     Note that this coding system does NOT comform to
63     JIS X 0208:1997 Appendix 1.
64    
65     =cut
66    
67     sub __2022__common ($) {
68     my $C = shift->SUPER::__2022__common;
69     $C->{G0} = $Encode::Charset::CHARSET{G94}->{B}; ## ASCII
70     $C;
71     }
72     sub __encode_map ($) {
73     [qw/ucs_to_ascii ucs_to_jisx0208_1997 ucs_to_jisx0201_katakana/];
74     }
75     sub __decode_map ($) {
76     [qw/jisx0208_1997_to_ucs jisx0201_katakana_to_ucs/];
77     }
78    
79     package Encode::SJIS::JIS::SJIS2000plane1;
80     use base 'Encode::SJIS';
81     __PACKAGE__->Define (qw!shift_jisx0213-plane1!);
82    
83     =item shift_jisx0213-plane1
84    
85     Shift_JISX0213-plane1 coded representation defined by JIS X 0213:2000
86     Appendix 1 (i.e. implemention level 3).
87    
88     =cut
89    
90     sub __2022_encode ($) {
91     my $C = shift->__2022__common;
92     $C->{G3} = $Encode::Charset::CHARSET{G94n}->{' @'}; ## undef
93     $C;
94     }
95     sub __encode_map ($) {
96     [qw/ucs_to_jisx0201_latin ucs_to_jisx0213_2000_1 ucs_to_jisx0201_katakana/];
97     }
98    
99     1;
100     __END__
101    
102     =back
103    
104     Coding systems C<shift_jisx0213> and C<shift_jisx0213-ascii>
105     are defined in Encode::SJIS.
106    
107     Shift JISes using alternative name (so mapped to HALFWIDTH
108     or FULLWIDTH area of UCS) defined by JIS X 0208:1997 or
109     JIS X 0213:2000 are not included in this module but in
110     Encode::SJIS::JISCompatible.
111    
112     Shift JISes with JIS X 0208-1978, -1983, -1990 are not
113     included in this module since these standards did not
114     define them. They are defined in Encode::SJIS::*
115     other than this module.
116    
117 wakaba 1.2 Being one of _JIS_ TR, shift JIS variants defined by
118     JIS TR X 0015 "XML Japanese profile" is not supported
119     by this module, but by other Encode::SJIS::*. Shift JISes
120     which is given name by JIS TR X 0015 are all vendor defined
121     version of Shift JIS and NOT part of formal JIS coded
122     character set standards. It is also a reason of not including
123     that the TR is too less quality to treat as same level
124     with formal JIS standards.
125    
126 wakaba 1.1 =head1 SEE ALSO
127    
128     JIS X 0208:1997, "7-bit and 8-bit double byte coded Kanji
129     set for information interchange", Japan Industrial Standards
130     Committee (JISC) <http://www.jisc.go.jp/>, 1997.
131    
132     JIS X 0213:2000, "7-bit and 8-bit double byte coded extended Kanji
133     sets for information interchange", Japan Industrial Standards
134     Committee (JISC) <http://www.jisc.go.jp/>, 2000.
135    
136     Encode::SJIS
137    
138     [IANAREG] "CHARACTER SETS", IANA <http://www.iana.org/>,
139     <http://www.iana.org/assignments/character-sets>.
140     The charset registry for IETF <http://www.ietf.org/> standards.
141    
142     =head1 LICENSE
143    
144     Copyright 2002 Nanashi-san
145    
146     This library is free software; you can redistribute it
147     and/or modify it under the same terms as Perl itself.
148    
149     =cut
150    
151 wakaba 1.2 # $Date: 2002/10/12 11:02:38 $
152 wakaba 1.1 ### SJIS.pm ends here

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24