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

reading in Latin1 w/ correct semantics [Was: Re: Smack!]

Thread Next
From:
Tom Christiansen
Date:
April 20, 2007 10:35
Subject:
reading in Latin1 w/ correct semantics [Was: Re: Smack!]
Message ID:
13757.1177090489@chthon
>On 20/04/07, Juerd Waalboer <juerd@convolution.nl> wrote:
>> > To replace the other functionality of encoding (pushing perlio layers
>> > to stdin and stdout), well, maybe a wrapper to binmode would make
>> > people happy, but I don't even see the need for a new module here.
>>
>> Or a magic encoding, "LOCALE" perhaps, so you could do:
>>
>>     binmode $_, ":encoding(LOCALE)" for *STDIN, *STDOUT;

>Sounds like C<use open IO => ':locale'>.
>While we're at it, a bit of self-promotion :
>http://search.cpan.org/~rgarcia/PerlIO-locale-0.03/locale.pm

Some systems have troubles with locales.  Is there a good locale-
independent way to set a stream to ISO8859-1 and have data read from there
count as U+0000 .. U+00FF with Unicode semantics, instead of just chr(0) ..
chr(127) being regular character data and chr(128) .. chr(255) being
non-character data lacking correct character semantics?  I think for all
the Latin-1 users in the Americas and Europe, this would help greatly.  Or
am I just forgetting how to make this work?  I tried binmod()ing to Latin1,
but it fails to deliver correct semantics, even though use encoding "Latin1" 
*does* make it work.

--tom

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