[tpm] Perl and Unicode
antoniosun001 at gmail.com
Fri May 1 10:03:01 PDT 2009
When you talked about the difficulties that Perl has calculating string
lengths, I didn't quite understand your explanation because I didn't catch
the term that you used. Could you explain it in writing please?
AFAIK, how Perl interprets string length depends on encoding, E.g.,
use encoding utf8;
print length("骆驼"); # 2, because there are 2 Chinese characters
print length("骆驼"); # 6, the 2 Chinese characters take up 6 bytes.
I.e., Perl has the capability to return whatever string length you want. Do
I miss anything?
Anyone knows how to split an Unicode string into individual characters?
E.g., from "骆驼" to '骆' & '驼'?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the toronto-pm