Unexpected lc behaviour

Mark Fowler mark at twoshortplanks.com
Sun Aug 25 16:47:29 BST 2013


I'm trying to lowercase capital e-acute and turn it into lowercase e-acute.
 Can anyone explain why this is different?

mark at travis-5:~$ perl -le 'print ord lc chr 201'
201
mark at travis-5:~$ perl -lE 'print ord lc chr 201'
233

Or for that matter:

perl -le 'my $chr = chr ord "\N{LATIN CAPITAL LETTER E WITH ACUTE}"; print
ord lc $chr'
201
perl -le 'my $chr = "\N{LATIN CAPITAL LETTER E WITH ACUTE}"; print ord lc
$chr'
233

I tried it on 5.12, 5.16 and 5.18 (later example obviously not tried as is
with 5.12)

It's not something as obvious as the utf-8 flag being on or off, since
changing -e to -E doesn't turn that on.

perl -MDevel::Peek -e 'Dump chr(201)'
SV = PV(0x7f955c004490) at 0x7f955c0133e0
REFCNT = 1
FLAGS = (POK,READONLY,pPOK)
PV = 0x7f955bc04850 "\311"\0
CUR = 1
LEN = 16

perl -MDevel::Peek -E 'Dump chr(201)'
SV = PV(0x7ff3f10044a0) at 0x7ff3f10133e0
REFCNT = 1
FLAGS = (POK,READONLY,pPOK)
PV = 0x7ff3f0c0ce30 "\311"\0
CUR = 1
LEN = 16

perl -MDevel::Peek -e 'Dump "\N{LATIN CAPITAL LETTER E WITH ACUTE}"'
SV = PV(0x7fb103849160) at 0x7fb1038133f8
REFCNT = 1
FLAGS = (POK,READONLY,pPOK,UTF8)
PV = 0x7fb103411db0 "\303\211"\0 [UTF8 "\x{c9}"]
CUR = 2
LEN = 16

Mark.

-- 
Mark Fowler
http://www.twoshortplanks.com/


More information about the london.pm mailing list