Show
Ignore:
Timestamp:
01/18/08 10:28:13 (10 months ago)
Author:
tokuhirom
Message:

lang/perl/Encode-JP-Mobile: added unicode_auto into kddi-table.*

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Encode-JP-Mobile/trunk/tools/kddi-extract.pl

    r1378 r4838  
    33use warnings; 
    44use Encode; 
     5use Encode::JP::Mobile; 
    56use CAM::PDF; 
     7 
     8# scraping from http://www.au.kddi.com/ezfactory/tec/spec/pdf/typeD.pdf 
    69 
    710my $file = shift or die "Usage: kddi-extract.pl typeD.pdf\n"; 
     
    912 
    1013my @res; 
    11 foreach my $p (1..$doc->numPages()) { 
     14for my $p (1..$doc->numPages()) { 
    1215    my $text = decode("shift_jis", $doc->getPageText($p)); 
    1316    while ($text =~ m/(\d+)(?: |[abcdef \x{FF43}\x{3000}]+|\x{306A}\x{3057} )([^ ]*) ([0-9A-F]{4})([0-9A-F]{4})([0-9A-F]{4})([0-9A-F]{4})/gs) { 
     
    1518        @data{qw( number name sjis unicode email_jis email_sjis )} = ($1, $2, $3, $4, $5, $6); 
    1619        $data{name} =~ s/\n//g; 
     20        $data{unicode_auto} = sprintf '%X', ord decode 'x-sjis-kddi-auto', pack "H*", $data{sjis}; 
    1721        push @res, \%data; 
    1822    }