develooper Front page | perl.perl5.porters | Postings from February 2003

Re: [perl #21395] rcatline doesn't grok utf8

Thread Previous | Thread Next
From:
Enache Adrian
Date:
February 28, 2003 01:35
Subject:
Re: [perl #21395] rcatline doesn't grok utf8
Message ID:
20030228092928.GA810@ratsnest.hole
On Thu, Feb 27, 2003 at 10:25:19PM -0000, Nicholas Clark wrote:
> This didn't appear to get logged as a bug:
> 
> $ echo >test; perl5.6.1 -lwe '$_ = chr 256; $_ .= <>; print ord $_' test
> 256
> $ echo >test; perl5.8.0 -lwe '$_ = chr 256; $_ .= <>; print ord $_' test
> 196

Please try this ( that's bleedperl, if you try on 5.8.0, you
have to remove the else .. in 2 or 3 places ).

note: the 'else SvUTF8_off()' is kind of useless, since
SvPOK_only has alreadly turned off the SVf_UTF8 flag.

Regards

Adi

-------------------------------------------------------------------
--- /arc/perl-current/sv.c	2003-02-26 04:50:55.000000000 +0200
+++ sv.c	2003-02-28 11:20:29.000000000 +0200
@@ -6247,7 +6247,7 @@ Perl_sv_gets(pTHX_ register SV *sv, regi
     (void)SvUPGRADE(sv, SVt_PV);
 
     SvSCREAM_off(sv);
-    SvPOK_only(sv);    /* Validate pointer */
+    append ? SvPOK_only_UTF8(sv) : SvPOK_only(sv);
 
     if (PL_curcop == &PL_compiling) {
 	/* we always read code in line mode */
@@ -6546,8 +6546,6 @@ screamer2:
 check_utf8_and_return:
     if (PerlIO_isutf8(fp))
 	SvUTF8_on(sv);
-    else
-	SvUTF8_off(sv);
 
     return (SvCUR(sv) - append) ? SvPVX(sv) : Nullch;
 }
-------------------------------------------------------------------

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