Re: length in (utf8) characters ?



Peter Billam wrote:
I'm confused... in "perldoc length" it says

if the EXPR is in Unicode, you will get the
number of characters, not the number of bytes.

which is what I would want. But (in a one-line demo
of a problem I have in a much larger module):

$> perl -e '$l=length "ö"; print "length=$l\n";'
length=2

But I want to see length=1 here... (in case your news-client
doesn't do utf8, that string was a o-umlaut) I'm using v5.10.1
on debian squeeze and everything else works fine in utf8.



When I paste the character in my newsreader, I am using ISO-8859-1, not UTF-8.
This works fine:

5.8.8 gives:
perl -e '$s="ö"; $l=length $s; print "length $s =$l\n";'
length ö =1

5.10.0 gives:
perl -e '$s="ö"; $l=length $s; print "length $s =$l\n";'
length ö =1
.