develooper Front page | perl.perl5.porters | Postings from August 2013

[perl #119499] $! returned with UTF-8 flag under UTF-8 locales only under 5.19.2+

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
August 29, 2013 06:40
Subject:
[perl #119499] $! returned with UTF-8 flag under UTF-8 locales only under 5.19.2+
Message ID:
rt-3.6.HEAD-1873-1377758408-893.119499-15-0@perl.org
On Wed Aug 28 10:19:47 2013, public@khwilliamson.com wrote:
> On 08/28/2013 02:52 AM, Victor Efimov (via RT) wrote:
> > I believe this is useless and just makes it harder to decode $! value
> > properly.
> 
> I don't have a clue as to why you think this is useless.  This change 
> was to fix https://rt.perl.org/rt3/Ticket/Display.html?id=112208
> (reported also as perl #117429, so more than one person found this to be 
> a bug).  The patch merely examines the string text of $!, and if it is 
> UTF-8, sets the flag indicating that.

You are describing from the point of view of internals.  From the user’s
standpoint, this means you are decoding $! if the character set is
UTF-8, but leaving it encoded otherwise.

This means even #112208 is not fixed, because the test case was ‘use
open <:std :encoding(utf-8)>’ followed by $!.  If $! is not utf-8 and
you try to feed it through STDOUT, you still get garbage on the screen.

The ultimate problem is that perl has no way of guaranteeing that $! can
be fed to STDOUT and come out correctly.  Even if it could do that,
there is no way for it to tell that STDOUT/STDERR is where $! is going
to go.

So now, $! may or may not be encoded, and you have to way of telling
reliably without doing the same environment checks that perl itself did
internally before deciding to decode $! itself.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=119499

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