Changeset 6465
- Timestamp:
- 02/10/08 11:53:20 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Encode-JP-Mobile/trunk/lib/Encode/JP/Mobile/KDDIJIS.pm
r5219 r6465 26 26 $str =~ s/([^\x00-\x7f].*)$//so and $residue = $1; 27 27 } 28 $residue .= jis_sjis( \$str );28 $residue .= _jis_sjis( \$str ); 29 29 $_[1] = $residue if $chk; 30 30 … … 35 35 my ( $obj, $utf8, $chk ) = @_; 36 36 my $octet = Encode::encode( $obj->_encoding, $utf8, $chk ); 37 return sjis_jis( $octet );37 return _sjis_jis( $octet ); 38 38 } 39 39 … … 41 41 sub JIS_0208 () { 2 } 42 42 sub KANA () { 3 } 43 sub sjis_jis {43 sub _sjis_jis { 44 44 my $octet = shift; 45 45 … … 113 113 } 114 114 115 sub jis_sjis {115 sub _jis_sjis { 116 116 local ${^ENCODING}; 117 117 … … 129 129 } else { 130 130 $chunk =~ s((..)){ 131 pack "H*", sprintf"%X", jis2sjis_one(hex(unpack "H*", $1));131 pack "H*", sprintf"%X", _jis2sjis_one(hex(unpack "H*", $1)); 132 132 }geox; 133 133 $chunk; … … 141 141 } 142 142 143 sub jis2sjis_one { my $x = shift; return ( xy($x) << 8 ) +zu($x) } # input is binary144 145 sub high { my $x = shift; $x >> 8 }146 sub low { my $x = shift; $x & 0xff }147 148 sub xy {143 sub _jis2sjis_one { my $x = shift; return ( _xy($x) << 8 ) + _zu($x) } # input is binary 144 145 sub _high { my $x = shift; $x >> 8 } 146 sub _low { my $x = shift; $x & 0xff } 147 148 sub _xy { 149 149 my $jis = shift; 150 150 151 my $pq = high($jis);151 my $pq = _high($jis); 152 152 my $t = ceil( $pq / 2 ) + 0x70; 153 153 my $ans = ($t <= 0x9F) ? $t : $t+0x40; … … 163 163 } 164 164 165 sub zu {165 sub _zu { 166 166 my $jis = shift; 167 my $pq = high($jis);168 my $rs = low($jis);167 my $pq = _high($jis); 168 my $rs = _low($jis); 169 169 170 170 if ( $pq % 2 ) { # odd
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)