This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove things added to v5.23.0 delta but meant for v5.23.1
[perl5.git] / pod / perllocale.pod
index fdf524f..701b422 100644 (file)
@@ -34,7 +34,8 @@ locales", based on Unicode.  These are locales whose character set is
 Unicode, encoded in UTF-8.  Starting in v5.20, Perl fully supports
 UTF-8 locales, except for sorting and string comparisons.  (Use
 L<Unicode::Collate> for these.)  Perl continues to support the old
-non UTF-8 locales as well.
+non UTF-8 locales as well.  There are currently no UTF-8 locales for
+EBCDIC platforms.
 
 (Unicode is also creating C<CLDR>, the "Common Locale Data Repository",
 L<http://cldr.unicode.org/> which includes more types of information than
@@ -104,7 +105,8 @@ deficiencies, so keep reading.
 
 =head1 PREPARING TO USE LOCALES
 
-Perl itself will not use locales unless specifically requested to (but
+Perl itself (outside the L<POSIX> module) will not use locales unless
+specifically requested to (but
 again note that Perl may interact with code that does use them).  Even
 if there is such a request, B<all> of the following must be true
 for it to work properly:
@@ -162,7 +164,8 @@ L<The setlocale function>.
 
 =head2 The C<"use locale"> pragma
 
-By default, Perl itself ignores the current locale.  The S<C<use locale>>
+By default, Perl itself (outside the L<POSIX> module)
+ignores the current locale.  The S<C<use locale>>
 pragma tells Perl to use the current locale for some operations.
 Starting in v5.16, there are optional parameters to this pragma,
 described below, which restrict which operations are affected by it.
@@ -215,6 +218,15 @@ underlying locale.  For more discussion, see L<perlxs/CAVEATS>.
 
 =back
 
+Note that all C programs (including the perl interpreter, which is
+written in C) always have an underlying locale.  That locale is the "C"
+locale unless changed by a call to L<setlocale()|/The setlocale
+function>.  When Perl starts up, it changes the underlying locale to the
+one which is indicated by the L</ENVIRONMENT>.  When using the L<POSIX>
+module or writing XS code, it is important to keep in mind that the
+underlying locale may be something other than "C", even if the program
+hasn't explicitly changed it.
+
 =for comment
 The nbsp below makes this look better (though not great)
 
@@ -556,7 +568,7 @@ The two quickest fixes are either to render Perl silent about any
 locale inconsistencies or to run Perl under the default locale "C".
 
 Perl's moaning about locale problems can be silenced by setting the
-environment variable C<PERL_BADLANG> to a zero value, for example "0".
+environment variable C<PERL_BADLANG> to "0" or "".
 This method really just sweeps the problem under the carpet: you tell
 Perl to shut up even when Perl sees that something is wrong.  Do not
 be surprised if later something locale-dependent misbehaves.
@@ -876,8 +888,8 @@ L<Perl will warn, default enabled|warnings/Category Hierarchy>,
 using the C<locale> warning category, whenever such a locale is switched
 into.)  The UTF-8 locale support is actually a
 superset of POSIX locales, because it is really full Unicode behavior
-as if no locale were in effect at all (except for tainting; see
-L</SECURITY>).  POSIX locales, even UTF-8 ones,
+as if no C<LC_CTYPE> locale were in effect at all (except for tainting;
+see L</SECURITY>).  POSIX locales, even UTF-8 ones,
 are lacking certain concepts in Unicode, such as the idea that changing
 the case of a character could expand to be more than one character.
 Perl in a UTF-8 locale, will give you that expansion.  Prior to v5.20,
@@ -898,8 +910,10 @@ but new-line) works on the platform character set.
 
 Starting in v5.22, Perl will by default warn when switching into a
 locale that redefines any ASCII printable character (plus C<\t> and
-C<\n>) into a different class than expected.  This is unlikely to
-happen on modern locales, but can happen with the ISO 646 and other
+C<\n>) into a different class than expected.  This is likely to
+happen on modern locales only on EBCDIC platforms, where, for example,
+a CCSID 0037 locale on a CCSID 1047 machine moves C<"[">, but it can
+happen on ASCII platforms with the ISO 646 and other
 7-bit locales that are essentially obsolete.  Things may still work,
 depending on what features of Perl are used by the program.  For
 example, in the example from above where C<"|"> becomes a C<\w>, and
@@ -1183,8 +1197,8 @@ of a match involving C<\w> while C<use locale> is in effect.
 
 =item PERL_SKIP_LOCALE_INIT
 
-This environment variable, available starting in Perl v5.20, and if it
-evaluates to a TRUE value, tells Perl to not use the rest of the
+This environment variable, available starting in Perl v5.20, if set
+(to any value), tells Perl to not use the rest of the
 environment variables to initialize with.  Instead, Perl uses whatever
 the current locale settings are.  This is particularly useful in
 embedded environments, see
@@ -1196,9 +1210,8 @@ A string that can suppress Perl's warning about failed locale settings
 at startup.  Failure can occur if the locale support in the operating
 system is lacking (broken) in some way--or if you mistyped the name of
 a locale when you set up your environment.  If this environment
-variable is absent, or has a value that does not evaluate to integer
-zero--that is, "0" or ""-- Perl will complain about locale setting
-failures.
+variable is absent, or has a value other than "0" or "", Perl will
+complain about locale setting failures.
 
 B<NOTE>: C<PERL_BADLANG> only gives you a way to hide the warning message.
 The message tells about some problem in your system's locale support,
@@ -1238,7 +1251,7 @@ priority than C<LC_ALL>.  Moreover, it's not a single value but
 instead a "path" (":"-separated list) of I<languages> (not locales).
 See the GNU C<gettext> library documentation for more information.
 
-=item C<LC_CTYPE>.
+=item C<LC_CTYPE>
 
 In the absence of C<LC_ALL>, C<LC_CTYPE> chooses the character type
 locale.  In the absence of both C<LC_ALL> and C<LC_CTYPE>, C<LANG>
@@ -1272,7 +1285,7 @@ C<LANG> chooses the date and time formatting locale.
 
 C<LANG> is the "catch-all" locale environment variable. If it is set, it
 is used as the last resort after the overall C<LC_ALL> and the
-category-specific C<LC_I<foo>>
+category-specific C<LC_I<foo>>.
 
 =back