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

Re: RFC: use locale "unicode"

Thread Previous | Thread Next
From:
Karl Williamson
Date:
December 22, 2011 08:37
Subject:
Re: RFC: use locale "unicode"
Message ID:
4EF35CA0.5000906@khwilliamson.com
On 12/19/2011 06:50 PM, Eric Brine wrote:
> On Mon, Dec 19, 2011 at 7:18 PM, Leon Timmermans <fawaka@gmail.com
> <mailto:fawaka@gmail.com>> wrote:
>
>     On Mon, Dec 19, 2011 at 9:42 PM, Karl Williamson
>     <public@khwilliamson.com <mailto:public@khwilliamson.com>> wrote:
>      > To be more specific.  the 'open :locale' causes your external
>     files to be
>      > translated into Unicode for perl to operate on, and back on
>     output, but it
>      > doesn't do anything about the rest of the locale, such as the
>     decimal point
>      > character in number printing.  Currently, 'use locale' causes the
>     decimal
>      > point character to work, and will operate on older traditional
>     single-byte
>      > locales with their character set, but will not work on newer utf8
>     locales.
>
>     PerlIO::locale currently doesn't work well on Windows though. The real
>     problem is simple: locale doesn't include character encoding there,
>
>
> I don't know what you mean by that because the character encoding is set
> in the same dialog as date, time, currency and number formats.
>
>     and it's not obvious what it should do instead. I added some code to
>     get the ANSI codepage, but that's unlikely to return something
>     particularly useful/unicode
>
>
> I don't know what you mean by that either. Why do you think this is
> unlikely to be useful?
>
>     , nor does Encode currently accept cp65001as UTF-8.
>
>
> Can the ANSI code page be 65001?
>
> Either way, that's not really a biggy.
>
> my $cp = GetACP();
> my $enc = $cp  == 65001 ? 'UTF-8' : "cp$cp";
>
> - Eric
>

I have been thinking of a better argument name, and at this point I like
use locale 'uni_chars';
better.

This means in effect "Use locale settings, except the program has 
arranged by other means to make the character set be Unicode"

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