perl-unicode

Alert: Encode alias implementation is buggy

2002-03-20 18:18:46
Encode Hackers,

I have found a big bug in alias implementation; you can't override alias later on!
  Suppose there is a user who wants to use vendor encoding.  S/he may

        Encode::define_alias( qr/sjis$/i => '"cp932"'); # Windoze or die!

  But you will still get shiftjis.
I checked the code and found that it is harder you may think, because we allow regexes and coderefs to alias. But I think I have come up with a solution. Very fortunately, regexes can be hash keys and we can even resort to use Tie::RefHash for coderef so it is theoretically possible to remove duplicates (currently aliases are pushed in an array so duplicates are possible. I believe this is a coderef concern). We still need an array to preserve order (or Tie::IxHash? But it is not included in the current perl dist) but the point is we have to find some way to override/overwrite alias settings....

Dan, aliased Yet Another Perl Encode Hacker


<Prev in Thread] Current Thread [Next in Thread>