perl-unicode

[PATCH] open.pm tweaks

2002-03-20 06:12:59
I was wrong when suggesting the zh_TW should mean big5; didn't look at
the code carefully enoough to see there's a glaring

    $locale_encoding eq 'euc' &&

conditional. Sorry.

Also patched is the problem of incorrectly probing for the 'encoding(xxx)'
layer, instead of just 'encoding' itself. Before this patch,

    use open ':encoding(big5)';

will erroneously print "Unknown discipline layer 'encoding(big5)'".

Thanks,
/Autrijus/

--- lib/open.pm Wed Mar 20 10:00:27 2002
+++ /usr/local/lib/perl5/5.7.3/open.pm  Wed Mar 20 20:47:33 2002
@@ -48,7 +48,7 @@
            } elsif ($country_language =~ /^zh_CN|chin(?:a|ese)?$/i) {
                $locale_encoding = 'euc-cn';
            } elsif ($country_language =~ /^zh_TW|taiwan(?:ese)?$/i) {
-               $locale_encoding = 'big5';
+               $locale_encoding = 'euc-tw';
            }
            croak "Locale encoding 'euc' too ambiguous"
                if $locale_encoding eq 'euc';
@@ -90,7 +90,10 @@
                }
                $std = 1;
            } else {
-               unless(PerlIO::Layer::->find($layer)) {
+               my $target = $layer;            # the layer name itself
+               $target =~ s/^(\w+)\(.+\)$/$1/; # strip parameters
+
+               unless(PerlIO::Layer::->find($target)) {
                    carp("Unknown discipline layer '$layer'");
                }
            }

Attachment: pgp74WXIMJnfg.pgp
Description: PGP signature

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