Re: length in (utf8) characters ?
- From: Steve C <smallpond@xxxxxxxx>
- Date: Thu, 29 Apr 2010 13:10:32 -0400
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
.
- References:
- length in (utf8) characters ?
- From: Peter Billam
- length in (utf8) characters ?
- Prev by Date: Re: length in (utf8) characters ?
- Next by Date: Re: length in (utf8) characters ?
- Previous by thread: Re: length in (utf8) characters ?
- Next by thread: Re: length in (utf8) characters ?
- Index(es):
Relevant Pages
|