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: pgp00000.pgp
Description: PGP signature

Reply via email to