in reply to Re: Perl Monks in other languages?
in thread Perl Monks in other languages?

grrr...you weren't kidding were you. Anyone with info on how make Japanese characters work, I would be happy for the info.

"Pain is weakness leaving the body, I find myself in pain everyday" -me

Replies are listed 'Best First'.
Re: Re: Re: Perl Monks in other languages?
by theorbtwo (Prior) on Jun 07, 2003 at 21:07 UTC

    You need to entitize all characters not within the latin-1 reptiore. I /belive/ this code will do it, assuming $_ is your text, stored as "proper" utf8, with perl's utf-8 flag set.

    my $ord; s/(.)/$ord=ord $1; if ($ord < 128) { $1; } else { "&#$1;"; } /ge;


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).