Re: Encode-2.07 vs. PerlIO::encoding

[email protected] (Nick Ing-Simmons)
Newsgroups perl.unicode,perl.perl5.porters
Message-ID <[email protected]>
Dan Kogai <[email protected]> writes:
>On Oct 24, 2004, at 06:41, Rafael Garcia-Suarez wrote:
>> Dan Kogai wrote:
>>> Within less than 24hrs I resorted to release version 2.07.  What the
>>> heck.  5.8.6 is soon....
>>
>> I applied 2.07 to bleadperl, and looks like something is broken in
>> PerlIO::encoding.
>> More precisely, ext/PerlIO/t/encoding.t fails test 14, that tests
>> open(F,'<:encoding(utf-8)',$threebyte).
>
>The easiest solution is the patch below;
>
>--- ext/PerlIO/encoding/encoding.pm.dist        Sat May 24 00:38:36 2003
>+++ ext/PerlIO/encoding/encoding.pm Sun Oct 24 13:38:45 2004
>@@ -12,7 +12,7 @@
>  use XSLoader ();
>  XSLoader::load(__PACKAGE__, $VERSION);
>
>-our $fallback = Encode::PERLQQ()|Encode::WARN_ON_ERR();
>+our $fallback = 
>Encode::PERLQQ()|Encode::WARN_ON_ERR()|Encode::RETURN_ON_ERR();
>
>  1;
>  __END__
>
>This makes perl-5.8.6 happy but the problem is that I have made 
>Encode::utf8 so that it accepts fallback values like Encode::XS (upon 
>the request by Bjoern Hoehrmann via RT).  

That is worthwhile - but a partial character has a mechanism in Encode::XS - 
Return any complete characters and leave the partial characters in the 
input SV.

>Encode::utf8 used to return 
>immediately at partial character but now Encode:RETURN_ON_ERR is 
>required, meaning those who installed Encode-2.07 on older perl are in 
>trouble w/ PerlIO.  So I am looking for a solution which does that 
>without tweaking PerlIO::encoding.

But in my humble optinion a partial character is NOT an error.
Snag is that with that set when a REAL error comes along it will return :-(

>
>I just want Encode::utf8->decode() to make sure Encode:RETURN_ON_ERR is 
>on when the callar is PerlIO::encoding...

Which would be a change - may be an improvement (I am not sure) - but a change.

Existing :encoding uses may be expecting Encode to croak/warn/replace 
bad characters. 


>
>Dan the Encode Maintainer
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.