Show
Ignore:
Timestamp:
11/16/07 08:28:37 (6 years ago)
Author:
tomi-ru
Message:

add custom fb sample and test.

Location:
lang/perl/Encode-JP-Mobile/branches/feature-convert-pictogram
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Encode-JP-Mobile/branches/feature-convert-pictogram/lib/Encode/JP/Mobile.pm

    r1560 r1608  
    88use base qw( Exporter ); 
    99BEGIN { 
    10     @EXPORT_OK = qw( InDoCoMoPictograms InKDDIPictograms InSoftBankPictograms InAirEdgePictograms ); 
     10    @EXPORT_OK = qw( InDoCoMoPictograms InKDDIPictograms InSoftBankPictograms InAirEdgePictograms InMobileJPPictograms ); 
    1111    %EXPORT_TAGS = ( props => [@EXPORT_OK] ); 
    1212} 
     
    8080} 
    8181 
     82sub InMobileJPPictograms { 
     83    return <<'END'; 
     84+Encode::JP::Mobile::InDoCoMoPictograms 
     85+Encode::JP::Mobile::InKDDIPictograms 
     86+Encode::JP::Mobile::InSoftBankPictograms 
     87+Encode::JP::Mobile::InAirEdgePictograms  
     88END 
     89} 
     90 
    82911; 
    8392__END__ 
  • lang/perl/Encode-JP-Mobile/branches/feature-convert-pictogram/lib/Encode/JP/Mobile/UTF8.pm

    r1560 r1608  
    22use strict; 
    33use warnings; 
    4 use Encode::JP::Mobile ':props'; 
    54use Encode::Alias; 
    65 
     
    2928            my $code = chr shift; 
    3029 
    31             if ( $check && $code =~ /\p{InDoCoMoPictograms}|\p{InSoftBankPictograms}|\p{InKDDIPictograms}|\p{InAirEdgePictograms}/ ) { 
     30            if ( $check && $code =~ /\p{Encode::JP::Mobile::InMobileJPPictograms}/ ) { 
    3231                Encode::encode( "x-utf8-${carrier}-pictogram", $code, $check ); 
    3332            } 
     
    4241 
    43421; 
     43__END__ 
     44 
     45=head1 NAME 
     46 
     47Encode::JP::Mobile::UTF8 - Pictogram characters conversion based on UTF-8 
     48 
     49=head1 SYNOPSIS 
     50 
     51    use Encode::JP::Mobile; 
     52     
     53    # KDDI sunny mark post-ed from charset=utf-8 page. 
     54    my $text = "\xEE\xBD\xA0"; 
     55    $text = decode('utf-8', $text); 
     56     
     57    print encode('x-utf8-docomo', $text); # DoCoMo sunny mark (\xEE\x98\xBE) 
     58    print encode('x-utf8-softbank', $text); # Softbank sunny mark (\xEE\x81\x8A) 
     59     
     60    # Softbank sunny mark and "It's here" mark post-ed from charset=utf-8 page. 
     61    # KDDI doesn't have the mark corresponding to "It's here".  
     62    my $text = "\xEE\x81\x8A\xEE\x90\xA8"; 
     63    print encode('x-utf8-kddi', $text, sub { '&#x3013;' }); # "It's here" to "GETA" 
     64 
     65=head1 AUTHOR 
     66 
     67Naoki Tomita, Tokuhiro Matsuno 
     68 
     69=head1 SEE ALSO 
     70 
     71L<Encode::JP::Mobile> 
     72 
  • lang/perl/Encode-JP-Mobile/branches/feature-convert-pictogram/t/emoji_convert_utf8_fb.t

    r1553 r1608  
    55use Encode qw(:fallback_all); 
    66 
    7 plan tests => 3; 
     7plan tests => 3 + 2; 
    88 
    99is encode('x-utf8-kddi', "\x{E652}", FB_XMLCREF), '&#xe652;', 'xmlcref fallback kddi'; 
     
    1111is encode('x-utf8-docomo', "\x{E538}", FB_XMLCREF), '&#xe538;', 'xmlcref fallback docomo'; 
    1212 
     13is encode('x-utf8-kddi', "\x{E04A}\x{E428}", sub { sprintf '<%X>', shift }), "\xEE\xBD\xA0<E428>"; 
     14is encode('x-utf8-kddi', "\x{E04A}\x{E428}", sub { '&#x3013;' }), "\xEE\xBD\xA0&#x3013;";