Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: minimalist perl-utf8 question

by kcott (Chancellor)
on Feb 02, 2013 at 07:00 UTC ( #1016658=note: print w/replies, xml ) Need Help??

in reply to minimalist perl-utf8 question

G'day, Didier,

I don't know what you were expecting. I'll assume you expected to see either 5 or 10 output from both scripts although maybe you expected something else - please clarify.

The utf8 pragma refers to characters in the source code - the documentation is very clear about this. So, when your e-acute characters are part of the source, what you have here is as to be expected.

For what it's worth, I'm using a Mac Pro and the same version of Perl as you:

$ perl -E 'say length q{ייייי}' 10 $ perl -E 'use utf8; say length q{ייייי}' 5

If the e-acute characters are external to the source code, use utf8; will have no effect:

$ perl -E 'say length $ARGV[0]' ייייי 10 $ perl -E 'use utf8; say length $ARGV[0]' ייייי 10

You might also like to take a look at the length function which also has some information regarding this issue.

-- Ken

Replies are listed 'Best First'.
Re^2: minimalist perl-utf8 question
by Anonymous Monk on Feb 02, 2013 at 09:08 UTC
    Thanks for explanations.

    I was expecting 5 for the length and 5 e-accutes for the string, whatever the coding of the characters.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1016658]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2018-06-18 19:46 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (110 votes). Check out past polls.