develooper Front page | perl.perl5.porters | Postings from April 2011

Re: Proposed update for 5.14 for perlunicode.pod

Thread Previous | Thread Next
From:
Karl Williamson
Date:
April 13, 2011 08:46
Subject:
Re: Proposed update for 5.14 for perlunicode.pod
Message ID:
4DA5C4E7.3000001@khwilliamson.com
On 04/12/2011 08:47 PM, Tom Christiansen wrote:
> I erroneously wrote:
>
>> Does that mean that Perl will do the right thing if I simply say
>
>>     use locale;
>
>> I don't think it will.
>
> I was wrong, but there is still something confusing me.
>
> This shows that use locale has a built-in setlocale:
>
>      % echo $PERL_UNICODE $LANG
>      S en_US.UTF-8
>
>      % blead -CS -Mlocale -le 'print "\u\xE9"'
>      É
>      % blead -CS -M-locale -le 'print "\u\xE9"'
>      é
>      % blead -CS -le 'print "\u\xE9"'
>      é
>      % blead -CS -lE 'print "\u\xE9"'
>      É
>
> But this shows that /u regexes don't work like I would
> think they would:
>
>      % blead -le 'print "\xE9" =~ s/(.)/\u$1/r'
>      é
>      % blead -Mlocale -le 'print "\xE9" =~ s/(.)/\u$1/r'
>      É
>
> But:
>
>      % blead -le 'print "\xE9" =~ s/(\w)/\u$1/lr'
>      é
>      % blead -le 'print "\xE9" =~ s/(.)/\u$1/ru'
>      é
>
> Drat.  It isn't using Unicode case mapping when you use /u.
> Is that expected?  So /u *isn't* like an automatic
> use feature unicode_strings any moreso than /l is (not) a
> an automatic use locale?
>
> I wonder why I keep thinking they are. :(
>
> --tom
>

I've now pushed to blead, at Jesses's suggestion, all the pod changes. 
These include things in perlre that address this confusion.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About