perl-unicode

Re: Interpretation of non-UTF8 strings

2004-08-16 08:30:07
W liście z pon, 16-08-2004, godz. 17:28 +0300, Jarkko Hietaniemi
napisał:

[qrczak ~]$ echo ąćę >1
[qrczak ~]$ perl -e 'use open ":locale"; open F, "1"; print <F>'
ąćę
[qrczak ~]$ perl -Mencoding=latin2 -e 'use open ":locale"; open F, "1"; 
print <F>'
"\x{66a8a}" does not map to iso-8859-2 at -e line 1, <F> line 1.

You probably need

perl -Mencoding=latin2 -C -e 'use open ":locale"; open F, "1"; print <F>'

With Perl 5.8.1 in SunOS 8 with LC_ALL set to pl_PL.ISO8859-2 I get
"ąćę" (0xb1 0xe6 0xea) with that.  I have to admit that needing the -C
smells like a bug, I'll investigate.

Works, thanks. What is weird, with use open ":encoding(latin2)"
it works without -C but doesn't work *with* -C, complaining about
wide character in print at -e line 1, <F> line 1.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak(_at_)knm(_dot_)org(_dot_)pl
    ^^     http://qrnik.knm.org.pl/~qrczak/

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