Jcode.pm - a successor to jcode.pl

[English][Japanese]

Last Modified:

by Dan Kogai

Foreword

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;

jcode.pl is not perl5--savvy

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");
print $str
;

Wouldn't it be nice if you can go like;

print jcode($str)->h2z->jis;

to do the same?

jcode.pl does not support MIME header

RFC1522 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 =?ISO-2022-JP?B? and ?=. Wouldn't it be nice if you can

$header = jcode($str)->encode_mime;

jcode.pl can't handle Unicode at all

I am not a big fan of Unicode but we have to admit the future is there...

So here comes Jcode.pm

So I have written Jcode.pm. It has all features available on jcode.pl-2.10 PLUS

Here is the documentation, Jcode.html Which is pod2html'd from Jcode.pm.

Install

is easy.

  1. Make sure you have perl5. Jcode.pm is for perl5 only.
  2. download Jcode-0.35.tar.gz
  3. gunzip Jcode-*.tar.gz | tar xf -
    # or "tar zxf Jcode-0.10.tar.gz" if your tar is gnu
  4. cd Jcode-*
  5. perl Makefile.PL
  6. make; make install

That's it! I will upload this package as soon as field test is complete so as soon as that happens, it will be as easy as "perl -MCPAN -e shell" and "install Jcode".