Tripletail
view release on metacpan or search on metacpan
lib/Tripletail/CharConv.pm view on Meta::CPAN
$UNICODE_JAPANESE_CODE{$code} = 1;
}
}
$INSTANCE;
}
sub _charconv {
my $this = shift;
my $str = shift;
my $from = shift;
my $to = shift;
if (!defined $str) {
die "TL#charconv: arg[1] is not defined. (第1弿°ãæå®ããã¦ãã¾ãã)\n";
}
elsif (ref $str) {
die "TL#charconv: arg[1] is a reference. [$str] (第1弿°ããªãã¡ã¬ã³ã¹ã§ã)\n";
}
if (!defined $from) {
$from = 'auto';
}
elsif (ref $from) {
die "TL#charconv: arg[2] is a reference. [$from] (第2弿°ããªãã¡ã¬ã³ã¹ã§ã)\n";
}
if (!defined $to) {
$to = 'UTF-8';
}
elsif (ref $to) {
die "TL#charconv: arg[3] is a reference. [$to] (第3弿°ããªãã¡ã¬ã³ã¹ã§ã)\n";
}
my $fromuj = $MAP_ENCODE_TO_UNIJP{$from} ? $MAP_ENCODE_TO_UNIJP{$from} : $from;
my $touj = $MAP_ENCODE_TO_UNIJP{$to } ? $MAP_ENCODE_TO_UNIJP{$to } : $to;
if ($UNICODE_JAPANESE_CODE{$fromuj} and $UNICODE_JAPANESE_CODE{$touj}) {
# 両æ¹ã¨ãUniJPã®ãµãã¼ãå
ãªãUniJPã§å¤æ
return Unicode::Japanese->new($str, $fromuj)->conv($touj);
}
elsif ($UNICODE_JAPANESE_CODE{$fromuj}) {
# çæ¹ãµãã¼ããªã®ã§utf8çµç±ã§å¤æ
my $utf8 = Unicode::Japanese->new($str, $fromuj)->utf8;
return Encode::find_encoding($to)->encode($utf8);
}
elsif ($UNICODE_JAPANESE_CODE{$touj}) {
# çæ¹ãµãã¼ããªã®ã§utf8çµç±ã§å¤æ
my $utf8 = Encode::find_encoding($from)->decode($str);
return Unicode::Japanese->new($str, 'utf8')->conv($touj);
}
else {
# 両æ¹ã¨ããµãã¼ãå¤
my $utf8 = Encode::find_encoding($from)->decode($str);
return Encode::find_encoding($to)->encode($utf8);
}
}
sub __new {
my $class = shift;
my $this = bless {} => $class;
return $this;
}
__END__
=encoding utf-8
=for stopwords
YMIRLINK
=head1 NAME
Tripletail::CharConv - å
é¨ã¯ã©ã¹
=head1 DESCRIPTION
L<Tripletail> ã«ãã£ã¦å
é¨çã«ä½¿ç¨ãããã
=head1 SEE ALSO
L<Tripletail>
=head1 AUTHOR INFORMATION
=over 4
Copyright 2006 YMIRLINK Inc.
This framework is free software; you can redistribute it and/or modify it under the same terms as Perl itself
ãã®ãã¬ã¼ã ã¯ã¼ã¯ã¯ããªã¼ã½ããã¦ã§ã¢ã§ããããªã㯠Perl ã¨åãã©ã¤ã»ã³ã¹ã® å
ã§åé
å¸åã³å¤æ´ãè¡ããã¨ãåºæ¥ã¾ãã
Address bug reports and comments to: tl@tripletail.jp
HP : http://tripletail.jp/
=back
=cut
( run in 0.925 second using v1.01-cache-2.11-cpan-e1769b4cff6 )