Is -C useless?
Paul LeoNerd Evans
leonerd at leonerd.org.uk
Thu Sep 11 23:06:39 BST 2008
On Thu, 11 Sep 2008 15:19:17 +0200
Paul Johnson <paul at pjcj.net> wrote:
> Which is just what you seem to have discovered ;-)
In that case, I might have to consider the following:
package utf8::LocaleAware;
my $converted = 0;
sub import
{
return if $converted;
$converted = 1;
return unless $ENV{LANG} =~ m/\.UTF-8/;
binmode STDIN, ":utf8";
binmode STDOUT, ":utf8";
require Encode;
map { $_ = Encode::decode_utf8 $_ } @ARGV, values %ENV;
}
Then just begin every program with
#!/usr/bin/perl
use utf8::LocaleAware;
But.. you know.. Suuuuurely there must be _some_ way to make -C not
useless?
Hell, even this might work:
#!/usr/bin/perl
BEGIN { exec $^X, "-C", @ARGV unless ${^UNICODE} }
--
Paul "LeoNerd" Evans
leonerd at leonerd.org.uk
ICQ# 4135350 | Registered Linux# 179460
http://www.leonerd.org.uk/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://london.pm.org/pipermail/london.pm/attachments/20080911/5417ffb3/signature-0001.pgp
More information about the london.pm
mailing list