[I18n-sig] string.count() chinese chars reliable?
Martin v. Loewis
martin@v.loewis.de
15 May 2002 10:18:24 +0200
"redpineseed" <redpineseed@telus.net> writes:
> assume t is a long string of mixed text of chinese and english
> is the following reliable?
>
> print string.count(t, x)
That depends on the value of t. If it is a single byte (e.g. ASCII
character), and if the encoding of x is Big5, then it is not reliable
- you may find occurrences of the ASCII byte which are part of a
multi-byte sequence.
It would be more reliable if you use Unicode.
Regards,
Martin