didess has asked for the wisdom of the Perl Monks concerning the following question:
I thought I'd understood a little of character encoding ... But now I'm completely lost :
Given these 2 minimal "scripts" : (you should see 5 e-accutes in the strings )
When I run the first one, I see 5 splendid e-acutes, but length is said 10cat miniUTF8.pl print 'ייייי ' , length 'ייייי' , "\n"; cat miniUTF8-2.pl use utf8; print 'ייייי' , length 'ייייי' , "\n";
When I run the second one, I see 5 question marks, but the length is 5
All this is done on a macbook pro, perl 5.14.2, locale on next lines, in the terminal window. The preferences of terminal are set for "UTF-8" encoding (that's why cat give good results)
Next line : an hexadecimal dump of the "print" line: One clearly sees it's utf8 encoded (0xa9c3 is e-acute)LANG="fr_FR.UTF-8" LC_COLLATE="fr_FR.UTF-8" LC_CTYPE="fr_FR.UTF-8" LC_MESSAGES="fr_FR.UTF-8" LC_MONETARY="fr_FR.UTF-8" LC_NUMERIC="fr_FR.UTF-8" LC_TIME="fr_FR.UTF-8" LC_ALL=
Any idea or explanation is welcome !!od -x miniUTF8.pl 0000000 7270 6e69 2074 c327 c3a9 c3a9 c3a9 c +3a9 0000020 20a9 2027 2c09 6c20 6e65 7467 2068 c +327 0000040 c3a9 c3a9 c3a9 c3a9 27a9 2c20 2020 5 +c22 0000060 226e 0a3b + 0000064
Didier
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: minimalist perl-utf8 question
by quester (Vicar) on Feb 02, 2013 at 06:36 UTC | |
|
Re: minimalist perl-utf8 question
by mbethke (Hermit) on Feb 02, 2013 at 06:54 UTC | |
|
Re: minimalist perl-utf8 question
by kcott (Archbishop) on Feb 02, 2013 at 07:00 UTC | |
by Anonymous Monk on Feb 02, 2013 at 09:08 UTC | |
|
Re: minimalist perl-utf8 question (perlunitut)
by Anonymous Monk on Feb 02, 2013 at 07:50 UTC | |
by Anonymous Monk on Feb 02, 2013 at 09:15 UTC | |
by zentara (Cardinal) on Feb 03, 2013 at 09:41 UTC |