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

Re: Proposed update for 5.14 for perlunicode.pod

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
April 12, 2011 20:04
Subject:
Re: Proposed update for 5.14 for perlunicode.pod
Message ID:
10746.1302662855@chthon
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

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