15 Apr 2008 14:51:37 UTC
- Distribution: Encode-Argv
- Module version: 0.00002
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (36 / 0 / 3)
- KwaliteeBus factor: 1
- License: perl_5
- Perl: v5.8.0
- Activity24 month
- Download (16.44KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionDMAKI Daisuke Makiand 1 contributors
- Copyright (c) 2008 Daisuke Maki
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:
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
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.