[tpm] Fwd: Perl and Unicode

Antonio Sun antoniosun at lavabit.com
Fri May 1 15:17:20 PDT 2009

Thanks a lot  Mike & Liam for the replies.

2009/5/1 Mike Stok <mike at stok.ca>

> Anyone knows how to split an Unicode string into individual characters?
> E.g., from "骆驼" to '骆' & '驼'?
> So both unpack 'U*' and split // work. I should have thought that split //
would work on Unicode too.

> There has to be a better way than this:
>   DB<7> @chars = map { chr } unpack('U*', "骆驼")

this teaches me that to pack back 'unpack' is not 'pack' but 'chr'. :-)

BTW, "骆驼" means camel in Chinese.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20090501/550da6ea/attachment-0001.html>

More information about the toronto-pm mailing list