summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-06-02 15:56:05 -0600
committerKarl Williamson <khw@cpan.org>2014-06-05 12:23:02 -0600
commit2c6ee1a7a1ce7cff7755f9aa43a65b8278dd82a1 (patch)
tree12f9cd50e04ff9cbc67d626248afad706da8ea17 /pod
parentdc36ed0caa7afbcad35a51601fe96c91233391a5 (diff)
downloadperl-2c6ee1a7a1ce7cff7755f9aa43a65b8278dd82a1.tar.gz
Use C locale for "$!" ouside 'use locale' scope
The stringification of $! has long been an outlier in Perl locale handling. The theory has been that these operating system messages are likely to be of use to the final user, and should be in their language. Things like No space left on device Can't fork are not something the program is likely to handle, but could be meaningfully helpful to the end-user. There are problems with this though. One is that many perl messages are in English, with the $! appended to them, so that the resultant message is of mixed language, and may need to be translated anyway. Things like No space left on device probably won't need the remaining portion of the message to give someone a clear indication as to what's wrong. But there are many other messages where both the OS error and the Perl error would be needed togther to understand the problem. An on-line translation tool can be used to do this. Another problem is that it can lead to garbage coming out on the user's terminal when the program is not expecting UTF-8, but the underlying locale is UTF-8. This is what happens in Bug #112208, and another that was merged with it. It's a lot harder to translate mojibake via an online tool than English. This commit solves that by using the C locale for messages, except within the scope of 'use locale'. It is extremely likely that the messages in the C locale will be English, but if not they will be ASCII, and there will be no garbage printed. A program that says "use locale" is indicating that it has the intelligence necessary to deal with locales.
Diffstat (limited to 'pod')
-rw-r--r--pod/perldelta.pod9
-rw-r--r--pod/perllocale.pod14
2 files changed, 15 insertions, 8 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 79de1c44db..5da82185fc 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -96,6 +96,15 @@ Really old Perl let you omit the @ on array names and the % on hash
names in some spots. This has issued a deprecation warning since Perl
5.0, and is no longer permitted.
+=head2 C<"$!"> text is now in English outside C<"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 C<"$^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.
+
=head1 Deprecations
XXX Any deprecated features, syntax, modules etc. should be listed here.
diff --git a/pod/perllocale.pod b/pod/perllocale.pod
index f371b9b66c..a5d776ae5b 100644
--- a/pod/perllocale.pod
+++ b/pod/perllocale.pod
@@ -191,14 +191,6 @@ follows:
=item *
-The variables L<$!|perlvar/$ERRNO> (and its synonyms C<$ERRNO> and
-C<$OS_ERROR>) and L<$^E|perlvar/$EXTENDED_OS_ERROR> (and its synonym
-C<$EXTENDED_OS_ERROR>) when used as strings always are in terms of the
-current locale and as if within the scope of L<"use bytes"|bytes>. This is
-likely to change in Perl v5.22.
-
-=item *
-
The current locale is also used when going outside of Perl with
operations like L<system()|perlfunc/system LIST> or
L<qxE<sol>E<sol>|perlop/qxE<sol>STRINGE<sol>>, if those operations are
@@ -314,6 +306,12 @@ L<Category C<LC_COLLATE>: Collation>.
B<Regular expressions and case-modification functions> (C<uc()>, C<lc()>,
C<ucfirst()>, and C<lcfirst()>) use C<LC_CTYPE>
+=item *
+
+The variables L<$!|perlvar/$ERRNO> (and its synonyms C<$ERRNO> and
+C<$OS_ERROR>) and L<$^E|perlvar/$EXTENDED_OS_ERROR> (and its synonym
+C<$EXTENDED_OS_ERROR>) when used as strings use C<LC_MESSAGES>.
+
=back
=back