diff options
author | SADAHIRO Tomoyuki <BQW10602@nifty.com> | 2001-06-25 07:48:21 +0900 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-24 13:14:31 +0000 |
commit | f57a1a59e517cf5178728261ce49c91ede5841a4 (patch) | |
tree | 4281338b79732d78fe3f928bbeda022af80078fb /ext | |
parent | 0322a713a271eb2b52432d4aa82e700773da354c (diff) | |
download | perl-f57a1a59e517cf5178728261ce49c91ede5841a4.tar.gz |
Encode::Tcl for multibyte doesnot work
Message-Id: <20010624223252.6658.BQW10602@nifty.com>
p4raw-id: //depot/perl@10886
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Encode/Encode/Tcl.pm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/Encode/Encode/Tcl.pm b/ext/Encode/Encode/Tcl.pm index 9068f27fc2..3ae20949cd 100644 --- a/ext/Encode/Encode/Tcl.pm +++ b/ext/Encode/Encode/Tcl.pm @@ -110,7 +110,7 @@ use Data::Dumper; sub read { my ($obj,$fh,$name,$type) = @_; - my $rep = $obj->can("rep_$type"); + my($rep, @leading); my ($def,$sym,$pages) = split(/\s+/,scalar(<$fh>)); my @touni; my %fmuni; @@ -122,6 +122,7 @@ sub read chomp($line); my $page = hex($line); my @page; + $leading[$page] = 1 if $page; my $ch = $page * 256; for (my $i = 0; $i < 16; $i++) { @@ -131,7 +132,7 @@ sub read my $val = hex(substr($line,0,4,'')); if ($val || !$ch) { - my $uch = chr($val); + my $uch = pack('U', $val); # chr($val); push(@page,$uch); $fmuni{$uch} = $ch; $count++; @@ -145,6 +146,8 @@ sub read } $touni[$page] = \@page; } + $rep = $type ne 'M' ? $obj->can("rep_$type") : + sub { ($_[0] > 255) || $leading[$_[0]] ? 'n' : 'C'}; $obj->{'Rep'} = $rep; $obj->{'ToUni'} = \@touni; $obj->{'FmUni'} = \%fmuni; @@ -157,13 +160,13 @@ sub rep_S { 'C' } sub rep_D { 'n' } -sub rep_M { ($_[0] > 255) ? 'n' : 'C' } +#sub rep_M { ($_[0] > 255) ? 'n' : 'C' } sub representation { my ($obj,$ch) = @_; $ch = 0 unless @_ > 1; - $obj-{'Rep'}->($ch); + $obj->{'Rep'}->($ch); } sub decode |