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

This is driving me nuts. I need to break down a bunch of kanji into hiragana (or katakana). What I've got:
#!/usr/bin/perl # # use strict; use warnings; use Text::Kakasi; my $k = Text::Kakasi->new('-JJ','-c','-w','-i utf8','-o utf8'); my $jpn = $k->get("–‚–@"); print "$jpn\n";

What's returned:
Wide character in print at ./kakasi.pl line 12. –‚–@
Searched around, but apparently not many people here use this module.

Replies are listed 'Best First'.
Re: Help with Kakasi
by lestrrat (Deacon) on Jul 27, 2005 at 07:17 UTC

    is line 12 print "$jpn\n"? If so, you just have a wide character. which is quite possible since you are asking Kakasi to return utf8.

    Try encoding this to some other encoding before you print. euc-jp?

    print encode('euc-jp', $jpn"), "\n";
      Well, that's probably but the problem is that $jpn holds the same string I pass to get()... in other words, it's apparently not doing anything.

      I also can't remember which module supports encode(). :/

        What is Kakasi supposed to do with a string containing all ascii characters? eh, nothing. Kakasi translates Japanese to alphabets so you can normalize them. it's not going to do anything with ascii characters

        And as gellyfish stated, you want Encode