16 |
|
|
17 |
package Message::MIME::Charset; |
package Message::MIME::Charset; |
18 |
use strict; |
use strict; |
19 |
use vars qw(%CHARSET %REG $VERSION); |
use vars qw(%CHARSET %MSNAME2IANANAME %REG $VERSION); |
20 |
$VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
$VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
21 |
|
|
22 |
&_builtin_charset; |
&_builtin_charset; |
99 |
'utf-32be' => \&_name_utf32be, |
'utf-32be' => \&_name_utf32be, |
100 |
); |
); |
101 |
|
|
102 |
|
%MSNAME2IANANAME = ( |
103 |
|
'iso-2022-jp' => 'x-iso2022jp-cp932', |
104 |
|
'ks_c_5601-1987' => 'windows-949', |
105 |
|
); |
106 |
|
|
107 |
sub make_charset ($%) { |
sub make_charset ($%) { |
108 |
my $name = shift; |
my $name = shift; |
109 |
return unless $name; ## Note: charset "0" is not supported. |
return unless $name; ## Note: charset "0" is not supported. |
162 |
(charset => $charset); |
(charset => $charset); |
163 |
} |
} |
164 |
|
|
165 |
|
sub msname2iananame ($) { |
166 |
|
my $mscharset = shift; |
167 |
|
$MSNAME2IANANAME{$mscharset} || $mscharset; |
168 |
|
} |
169 |
|
|
170 |
sub _name_7bit_iso2022 ($$) {shift; |
sub _name_7bit_iso2022 ($$) {shift; |
171 |
my $s = shift; |
my $s = shift; |
172 |
if ($s =~ /[\x0E\x0F\x1B]/) { |
if ($s =~ /[\x0E\x0F\x1B]/) { |