perl-unicode

Re: Newbie unicode/chinese question

2003-03-27 09:30:07
On Thu, Mar 27, 2003 at 03:36:33AM -0000, regulator wrote:
thats unicode?  How would I go about counting how many Chinese characters
are there when they enter Chinese instead of just counting the number of
characters?  ie ?? should be 1 character not 8.

Please use my Encode::HanDetect module and Perl 5.8+.

        use Encode;
        use Encode::HanDetect;
        use Encode::Guess qw(utf8 latin1); # fallbacks

        # now read in $data...
        my $data = <STDIN>;
        my $utf8 = decode("HanDetect", $data);
        print length($utf8);

Thanks,
/Autrijus/

Attachment: pgpEe3x00KMLA.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>