Encode::Argv - Automatically Mess With @ARGV's Encoding
use Encode::Argv ('cp932'); # Now @ARGV is decoded unicode characters, decoded from cp932 use Encode::Argv ('cp932' => 'euc-jp'); # Now @ARGV is encoded into euc-jp after being decoded from cp932 use Encode::Argv; # Now @ARGV is decoded from whatever Term::Encoding thinks you are # using on your terminal.
I saw http://search.cpan.org/dist/Sjis|Sjis.pm and http://www.aritia.org/hizumi/perl/perlwin.html|this, and thought, "Well, I can't fix /all/ of their problems, but I can at least start".
So here's a module that silently encodes/decodes your @ARGV from/to encodings supported by Encode.pm
All you need to do is to simply specify the encodings you want to use:
use Encode::Argv ('cp932');
There, you got yourself an unicode @ARGV on ShiftJIS Windows.
If in case you don't even want to explicitly specify what encoding to use, you could rely on Term::Encoding to find out what you are using. In that case you don't have to specify anything:
use Encode::Argv;
If Term::Encoding is not found, no decoding will be performad
Of course, this doesn't solve the entire problem, but it's at least a start
Copyright (c) 2008 Daisuke Maki daisuke@endeworks.jp
daisuke@endeworks.jp
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
To install Encode::Argv, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Encode::Argv
CPAN shell
perl -MCPAN -e shell install Encode::Argv
For more information on module installation, please visit the detailed CPAN module installation guide.