Last Modified:Sunday, 11-May-2008 03:16:47 JST
by Dan Kogai
As of Perl 5.8.0, all the Jcode capabilities are avaialble in standard distribution via Encode module Though I will maitain Jcode for old perls, I recommend that you use Encode if your perl is new enough. Encode more featureful, robust, and most of all, standard.
As of Jcode 2.0, Jcode now acts as a wrapper to Encode for perl 5.8.1 and better.
In those cases, Jcode.pm is self-contained so you don't even have to make install. All you have to do is copy Jcode.pm to the library path, a la jcode.pl.
For older perls, Jcode works the same as version 0.88.
Is a Perl module that handles various Japanese charsets. It has all features available on jcode.pl-2.10 PLUS
Here is the documentation, Jcode.html Which is pod2html'd from Jcode.pm.
See Changes for changes. Old Changes are available as Changes.ver0X.
Now that Jcode.pm is an official OpenLab Project, Jcode.pm has an official mailing list for that purpose.
This is more recommended because of the network bandwidth. Also note CPAN modules checks the version number so you can always download the latest version that way.
$ perl -MCPAN -e shell
If you are in Japan.
If you are too insatiable to wait for CPAN to update, here's how.
If you have installed Jcode prior to version 0.50 manually (That
is, without "perl Makefile.PL" trick. So this applies to Mac and
Windows users only), please delete old version of Jcode.pm and
Jcode directory in @INC manually before installing the new
When unicode conversion is needed, newer version of Jcode first tries to load Jcode::Unicode and if it fails (case for Mac, Windows, or such environment where XS is not supported), load Jcode::Unicode::NoXS. So Jcode gets confused if an older version of Jcode/Unicode.pm file still remains. Sorry for inconvenience.
This much should suffice for most cases.
perl -MJcode -i.bak -lpe 'Jcode::convert(\$_,
perl -MJcode -i.bak -lne 'print
original files are
perl -MJcode -00lne 'print
With Encode This section is somewhat obsolete but I'll leave it anyhow.
Virtually all Japanese perl coders must have used jcode.pl, a perl code that converts Japanese text from one char set or another. While jcode.pl has all the functinalities necessary, it has following problems;
While it runs OK on perl5, you have to use typegrobs or
references to give
jcode::convert() right arguments. It
doesn't look great to say
jcode::convert(\$str, 'jis', jcode::getcode(\$str), "z");;
Wouldn't it be nice if you can go like;
to do the same?
states that converting string to iso-2022-jp is not enought to put
it into MIME header. You have to further convert the string with
base64, then sandwitch that with
?=. Wouldn't it be nice if you can
$header = jcode($str)->encode_mime;
I am not a big fan of Unicode but we have to admit the future is there...