Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: encoding for $!

by Anonymous Monk
on Jun 29, 2014 at 14:41 UTC ( [id://1091638]=note: print w/replies, xml ) Need Help??


in reply to encoding for $!

For future reference, the perldelta file for Perl 5.21.1 says:

"$!" text is now in English outside "use locale" scope
Previously, the text, unlike almost everything else, always came out based on the current underlying locale of the program. (Also affected on some systems is ""$^E"".) For programs that are unprepared to handle locale, this can cause garbage text to be displayed. It's better to display text that is translatable via some tool than garbage text which is much harder to figure out.

"$!" text will be returned in UTF-8 when appropriate
The stringification of $! and $^E will have the UTF-8 flag set when the text is actually non-ASCII UTF-8. This will enable programs that are set up to be locale-aware to properly output messages in the user's native language. Code that needs to continue the 5.20 and earlier behavior can do the stringification within the scopes of both 'use bytes' and 'use locale ":messages"'. No other Perl operations will be affected by locale; only $! and $^E stringification. The 'bytes' pragma causes the UTF-8 flag to not be set, just as in previous Perl releases. This resolves perl #112208.

This looks to me like a good news/bad news situation. The good news is that help is on the way. The bad news is that it is a year away, and whatever you do to ameliorate the situation now will have to be redone when 5.22 comes out. Plus you will have to actually upgrade to 5.22 when it gets here.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1091638]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-19 09:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found