perl-unicode

Re: Make test failure depends upon $LANG

2003-04-26 04:30:07
On Saturday, April 26, 2003, at 01:31  AM, Blair Zajac wrote:
[snip]
On one box that is a fresh install of RedHat 9:

% cat /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SUPPORTED="en_US.UTF-8:en_US:en"
SYSFONT="latarcyrheb-sun16"

and make test fails:
[snip]
% perl -I../blib/lib -I../blib/arch t/enc_module.t
1..3
not ok 1 - encoding vs. STDOUT
#     Failed test (t/enc_module.t at line 45)
#          got: '1'
#     expected: '0'
ok 2 - encoding vs. STDIN - 1
ok 3 - encoding vs. STDIN - 2
# Looks like you failed 1 tests of 3.

Best,
Blair

I smell double encoding here.

encoding.pm
  68: for my $h (qw(STDIN STDOUT)){
  69:   if ($arg{$h}){
  70:       unless (defined find_encoding($arg{$h})) {
  71:           require Carp;
  72:           Carp::croak("Unknown encoding for $h, '$arg{$h}'");
  73:       }
  74:       eval { binmode($h, ":raw :encoding($arg{$h})") };
  75:   }else{
  76:       unless (exists $arg{$h}){
  77:           eval {
  78:               no warnings 'uninitialized';
  79:               binmode($h, ":raw :encoding($name)");
  80:           };
  81:       }
  82:   }

As you see filehandle layers here are first applied :raw then :encoding. Usually this :raw part is 'unix' or 'crlf', depending on your Encoding but I think :raw gets it to ":encoding(utf8)". Hmm....

If you have bleedperl, would you try running one-liner below?


bleedperl -MPerlIO -le 'print join("," => PerlIO::get_layers(STDOUT))'

What does this print?

Dan the Encode Maintainer


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