Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks
I am thinking of using Jcode.pl to translate EUC to S-JIS.
I have downloaded Jcode but i am not able to under stand
how to use it in the perl code.(ie how to do the conversion).
Any help will be appreciated. Thanks

Replies are listed 'Best First'.
Re: simple jcode
by tachyon (Chancellor) on Feb 10, 2003 at 06:59 UTC

    This is a very old module in perl 4 syntax. To use it save jcode.pl within you perl @INC path. Here is a script to do it for you (obviously you will need to set the correct path to where you saved the script:

    #!/usr/bin/perl use File::Copy; # point this to where the script currently is my $jcode_path = '/home/me/scripts/jcode.pl'; copy( $jcode_path, "$INC[0]/jcode.pl" );

    This will place a copy of the script where perl can find it. Now you just go:

    #!/usr/bin/perl require "jcode.pl"; # now you can use it as per perl 5 synopsis $code = jcode::getcode(\$line);

    That being said don't bother with this as there are some good JCODE modules on the ever faithful CPAN that do what you want, have much better documentation and will do the conversion in two lines (see the docs)

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: simple jcode
by iguanodon (Priest) on Feb 10, 2003 at 10:38 UTC
    If you're using Perl 5.8.0, you should be able to do this conversion with the standard Encode module.