Consider the following: #!/usr/bin/perl -COL
print "Hello w\xe9rld\n";
$ perl test.pl
Too late for "-COL" option at test.pl line 1.
WTF?? If that's "too late", where else can I put it?
If I remove it from the file:
$ perl -COL test.pl
Hello wérld
But of course now STDOUT isn't UTF-8.
$ perl test.pl
Hello w�ld
This can be fixed by:
#!/usr/bin/perl
binmode STDOUT, ":utf8" if $ENV{LANG} =~ m/\.UTF-8$/;
print "Hello w\xe9rld\n";
$ perl test.pl
Hello wérld
But of course, this is the exact behaviour that -COL is supposed to
provide; and yet is "too late" by the shebang time.. Yet, clearly not
because I can do it even later at runtime.
Can anyone offer any insight here?
--
Paul "LeoNerd" Evans
[EMAIL PROTECTED]
ICQ# 4135350 | Registered Linux# 179460
http://www.leonerd.org.uk/
signature.asc
Description: PGP signature
