This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Work round the fact that $hash->{$key} does not take into account
authorNick Ing-Simmons <nik@tiuk.ti.com>
Sun, 8 Oct 2000 11:51:26 +0000 (11:51 +0000)
committerNick Ing-Simmons <nik@tiuk.ti.com>
Sun, 8 Oct 2000 11:51:26 +0000 (11:51 +0000)
UTF8'ness of $key yet.  Thus fromUnicode needs to do $hash->{chr(ord($ch))}
so that key is always in the "expected" encoding - i.e. same way we put
it in the hash.

p4raw-id: //depot/perl@7166

ext/Encode/Encode.pm

index abcbf36..6af4548 100644 (file)
@@ -509,7 +509,7 @@ sub fromUnicode
  while (length($uni))
   {
    my $ch = substr($uni,0,1,'');
-   my $x  = $fmuni->{$ch};
+   my $x  = $fmuni->{chr(ord($ch))};
    unless (defined $x)
     {
      last if ($chk);