perl-unicode

Re: Interpretation of non-UTF8 strings

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

The encoding pragma partially works. It doesn't influence assumed
encoding of files opened without specifying the encoding, nor handling
of filenames, and it needs to be told about the encoding literally.
How to say it should be taken from the locale?

The 'use open ":locale"' does not work for you?

[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.

Also, 'use encoding' must still have the encoding specified literally,
it can't be taken from the locale (I can live with that in the case of
the Kogut <-> Perl bridge, as I can just put the encoding there because
I determine it myself anyway), and neither fixes handling of filenames.

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

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