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| and|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

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


This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.