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

Re: [perl #119499] $! returned with UTF-8 flag under UTF-8 localesonly under 5.19.2+

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
September 1, 2013 15:25
Subject:
Re: [perl #119499] $! returned with UTF-8 flag under UTF-8 localesonly under 5.19.2+
Message ID:
CAHhgV8i9F54gbUzgr2fEOwPwtGSJiH8Rdn6M-fNA5eEB45p-+g@mail.gmail.com
On Sun, Sep 1, 2013 at 6:36 AM, Karl Williamson <public@khwilliamson.com>wrote:

> And $! remains an outlier in the sense that it is AFAIK, and I've looked
> hard (perhaps not hard enough), now the only place (except for some POSIX::
> routines) where the program's underlying current locale leaks outside the
> scope of 'use locale'.


Yeah, in POSIX strftime and the is* functions are also affected.


> The main argument that I've heard for doing that is that $! is often for
> the end-user and not the programmer.  But it isn't for the end user if what
> gets displayed is gibberish, which includes being in some language the user
> doesn't know, though the latter is better than garbage bytes.  So what I'm
> advocating is re-examining whether we wish $! to respect 'use locale' or
> not.  If we chose to respect 'use locale', outside that, it would return
> messages in the system default locale, typically "C".
>

That does sounds like consistency to me.

I'm pretty confident that the problem can't be solved so that no code has
> to change and things just start working correctly for everybody.
>

That is my feeling too. The new situation feels rather unfinished to me,
but the old situation was clearly not the most useful behavior we can offer.

Currently, using $! in production code that can be operated by users who
> might have their own locales is much more complicated than people imagine.
>  "die $!" could print gibberish.


Indeed.

Leon

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