(keitai-l) ISO-2022-JP -> Shift_JIS

From: Isamar Maia <isamar_at_oaklawn.co.jp>
Date: 08/01/03
Message-ID: <NFBBLJGMKMNDGEPKFIGBAENKGJAA.isamar@oaklawn.co.jp>
Dear Sirs,

Maybe this issue is a little bit out-of-topic but
I didn't find a better list to post this problem.

I'm using http://www.otrs.org to keep track customer support incoming mails.

I did a little and simple script to receive the mails and translate them to
Shift_JIS, the enconding
that I got the best print in the browser.
The problem is that when I show the messages(originally ISO-2022-JP encoded)
in a PC browser, sometimes,
one Hiragana character is broken.

The script is:


use Jcode;
my $emenda = "";
while (my $line = <STDIN>) {
                if( $line  =~ "iso-2022-jp" || $line  =~ "ISO-2022-JP" )
		{
                        my $jconv = new Jcode($line);
                        my $emenda = $jconv->mime_decode;
                        Jcode::convert(\$emenda,'sjis','jis',"z");
                        print $emenda;

                }
                else {
                           my $jconv= new Jcode($line);

 		   my $jconv= new Jcode($line);
                           print $jconv->sjis;

                        }

}


I appreciate any help.


Isamar
Received on Fri Aug 1 15:14:37 2003