root/lang/perl/Encode-JP-Mobile/branches/feature-convert-pictogram/lib/Encode/JP/Mobile/DocomoUTF8.pm @ 1510

Revision 1510, 0.5 kB (checked in by tomi-ru, 7 years ago)

added DocomoUTF8.pm, SoftbankUTF8.pm, and test.

Line 
1package Encode::JP::Mobile::DocomoUTF8;
2use strict;
3use base qw(Encode::Encoding);
4__PACKAGE__->Define(qw(x-utf8-docomo));
5
6use Encode::Alias;
7define_alias('x-utf8-imode' => 'x-utf8-docomo');
8
9sub decode($$;$) {
10    my($self, $char, $check) = @_;
11    my $str = Encode::decode('utf8', $char);
12    $_[1] = $str if $check;
13    $str;
14}
15
16sub encode($$;$) {
17    my($self, $str, $check) = @_;
18    my $res = Encode::encode('x-utf8-docomo-pictogram', $str, sub {
19        Encode::encode('utf8', chr shift);
20    });
21    $_[1] = $res if $check;
22    $res;
23}
24
251;
Note: See TracBrowser for help on using the browser.