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 19:29
Subject:
Re: Proposed update for 5.14 for perlunicode.pod
Message ID:
7954.1302661721@chthon
> +When C<use locale> is in effect (which overrides C<use
> +feature 'unicode_strings'>), Perl uses the semantics
> +associated with the current locale.

How does this different from C<use re "/l">?

Does this mean that Perl will act like other utilities 
with respect to locales, or must you do something extra
with Perl that you do not have to do with the others?

Starting from en_US.UTF-8:

    % perl -CS -le 'print "\xE9"' | tr "[:lower:]" "[:upper:]"
    É

I need only change my locale, and tr will now recognize the single byte 0xE9
as something to convert to upper case:

    % perl -C0 -le 'print "\xE9"' | env LC_ALL=en_US.ISO-8859-1 tr "[:lower:]" "[:upper:]" | iconv -f ISO-8859-1 -t UTF-8
    É

Does that mean that Perl will do the right thing if I simply say

    use locale;

I don't think it will.

So I don't understand what use locale is for.

--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