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

Re: use locale

Thread Previous | Thread Next
From:
Gisle Aas
Date:
March 13, 2011 06:30
Subject:
Re: use locale
Message ID:
9EDAF25C-9006-4056-B6AE-0101768A16D4@activestate.com
On Mar 13, 2011, at 6:45, Zsbán Ambrus wrote:

> On Sat, Mar 12, 2011 at 11:27 PM, demerphq <demerphq@gmail.com> wrote:
>> On 12 March 2011 23:00, Zsbán Ambrus <ambrus@math.bme.hu> wrote:
>>> On Sat, Mar 12, 2011 at 12:37 PM, demerphq <demerphq@gmail.com> wrote:
>>>> I consider "use locale" broken and preserved only for backwards
>>>> compatibility. IMO we should get rid of it, deprecate it, whatever.
>>> 
>>> Er what?  How do I do a locale-aware string compare without it?  I'm
>>> not supposed to call POSIX::strcoll?
>> 
>> Its a personal opinion. Please let us know how you use it and why.
> 
> Well, just because you ask.  I personally have exactly two uses for
> locales (but I don't deny that other people may have more needs).
> 
> 
> The first use is to let various programs guess the encoding of the
> terminal from it.

I found the same need recently and ended up with creating
Encode::Locale [1].  It tries to use locale where it applies and other similar
means where it doesn't (like Windows). The locale is also a good guess
for the encoding of @ARGV and %ENV.  It also tries to address the
encoding for file names.

--Gisle


[1] http://search.cpan.org/dist/Encode-Locale/lib/Encode/Locale.pm


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