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

Re: RFC: Handling utf8 locales

Thread Previous | Thread Next
From:
Gisle Aas
Date:
June 26, 2011 13:32
Subject:
Re: RFC: Handling utf8 locales
Message ID:
D104E7DC-6988-47E9-8C12-FFDDE18AF2BA@activestate.com
On Jun 26, 2011, at 15:10 , Rafael Garcia-Suarez wrote:

> On 26 June 2011 13:17, Leon Timmermans <fawaka@gmail.com> wrote:
>> On Sun, Jun 26, 2011 at 10:33 AM, Zefram <zefram@fysh.org> wrote:
>>> We should discourage the use of locale-encoded strings within Perl space.
>>> We should encourage decoding on input, encoding on output, and using
>>> native Unicode representation in the middle.  To this end, there should
>>> be a PerlIO layer :locale, which {de,en}codes according to the locale's
>>> preferred encoding.  The locale's encoding may perfectly well be UTF-8,
>>> and in *this* context we can handle it in an entirely regular manner,
>>> on a par with ISO-8859-*.
>> 
>> There is such a module on CPAN, but it's currently broken by design. I
>> think I just fixed that in my repo, though that involved a complete
>> rewrite. I think this module may be a good candidate for core in 5.16.
> 
> I just uploaded PerlIO::locale 0.07 with Leon's changes to CPAN.

My attempt at this is the Encode::Locale module[1].  This also tries to handle
the fact that on Windows the console "locale" might be different and that the
"locale" to use for file names have divergent rules.

That module has also accumulated some hacks to deal with mappings where there
isn't the strait correspondence between what langinfo() returns and the encoding
names Encode knows about.

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