Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: function length() in UTF-8 context

by ikegami (Patriarch)
on Nov 19, 2008 at 10:57 UTC ( [id://724536]=note: print w/replies, xml ) Need Help??


in reply to Re^4: function length() in UTF-8 context
in thread function length() in UTF-8 context

I got constant strings which I typed in the script with accented chars UTF8-encoded.

If your source code is UTF-8, use use utf8;.

>perl -le"binmode STDOUT, ':encoding(iso-latin-1)'; print qq{print len +gth '\x85'}" | perl -l 1 Good >perl -le"binmode STDOUT, ':utf8'; print qq{print length '\x85'}" | pe +rl -l 2 BAD! >perl -le"binmode STDOUT, ':utf8'; print qq{use utf8; print length '\x +85'}" | perl -l 1 Good

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://724536]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-25 04:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found