Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> writes: >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>' >ÄÄÄ
Seems to work. >[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. Seems we may have a double encoding problem there, open :locale says "please take characters from file in locales encoding and convert them to unicode". While use encoding qw(latin2) says assume chars are latin2 (and they aren't any more as encoding layer has converted them for you.) Hmm. > >Also, 'use encoding' must still have the encoding specified literally, Which makes a kind of sense to me. 'use encoding qw(...)' (mainly) sets meaning of literals in the script. Presumably you know what encoding you are in when you write your script, but you don't know what locale user will be in when script gets run.