X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperllocale.pod;h=a257e380c009900be225432a7da1924511090acc;hb=aaa68c4a88ea4a62f62819baf4cacc0ca679c5fa;hp=0a85c0eb11d3b68cf10543e880e515e10c39993c;hpb=8ada0baa1f731edbe470a7630cfeb30c131b4672;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perllocale.pod b/pod/perllocale.pod index 0a85c0e..a257e38 100644 --- a/pod/perllocale.pod +++ b/pod/perllocale.pod @@ -215,6 +215,8 @@ I section). If that fails, try the following command lines: ls /usr/lib/nls + ls /usr/share/locale + and see whether they list something resembling these en_US.ISO8859-1 de_DE.ISO8859-1 ru_RU.ISO8859-5 @@ -225,18 +227,18 @@ and see whether they list something resembling these english.iso88591 german.iso88591 russian.iso88595 english.roman8 russian.koi8r -Sadly, even though the calling interface for setlocale() has -been standardized, names of locales and the directories where the +Sadly, even though the calling interface for setlocale() has been +standardized, names of locales and the directories where the configuration resides have not been. The basic form of the name is -IB<.>I, but the latter parts after -I are not always present. The I and I are -usually from the standards B and B, the two-letter -abbreviations for the countries and the languages of the world, -respectively. The I part often mentions some B -character set, the Latin codesets. For example, C is the -so-called "Western codeset" that can be used to encode most Western -European languages. Again, there are several ways to write even the -name of that one standard. Lamentably. +IB<.>I, but the latter parts after +I are not always present. The I and I +are usually from the standards B and B, the +two-letter abbreviations for the countries and the languages of the +world, respectively. The I part often mentions some B character set, the Latin codesets. For example, C +is the so-called "Western European codeset" that can be used to encode +most Western European languages adequately. Again, there are several +ways to write even the name of that one standard. Lamentably. Two special locales are worth particular mention: "C" and "POSIX". Currently these are effectively the same locale: the difference is @@ -276,10 +278,10 @@ 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 PERL_BADLANG to a non-zero value, for example -"1". 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. +environment variable PERL_BADLANG to a zero value, for example "0". +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. Perl can be run under the "C" locale by setting the environment variable LC_ALL to "C". This method is perhaps a bit more civilized @@ -287,7 +289,7 @@ than the PERL_BADLANG approach, but setting LC_ALL (or other locale variables) may affect other programs as well, not just Perl. In particular, external programs run from within Perl will see these changes. If you make the new settings permanent (read on), all -programs you run see the changes. See L for for +programs you run see the changes. See L for the full list of relevant environment variables and L for their effects in Perl. Effects in other programs are easily deducible. For example, the variable LC_COLLATE may well affect @@ -307,7 +309,7 @@ discussed above. We decided to try that instead of the above faulty locale "En_US"--and in Cshish shells (B, B) setenv LC_ALL en_US.ISO8859-1 - + If you do not know what shell you have, consult your local helpdesk or the equivalent. @@ -330,9 +332,9 @@ Second, if using the listed commands you see something B (prefix matches do not count and case usually counts) like "En_US" without the quotes, then you should be okay because you are using a locale name that should be installed and available in your system. -In this case, see L. +In this case, see L. -=head2 Permanently fixing your locale configuration +=head2 Permanently fixing your system's locale configuration This is when you see something like: @@ -349,7 +351,7 @@ rules for matching locale names are a bit vague because standardization is weak in this area. See again the L about general rules. -=head2 Permanently fixing system locale configuration +=head2 Fixing system locale configuration Contact a system administrator (preferably your own) and report the exact error message you get, and ask them to read this same documentation you @@ -447,7 +449,7 @@ if you "use locale". a A b B c C d D e E a b c d e A B C D E -Here is a code snippet to tell what alphanumeric +Here is a code snippet to tell what "word" characters are in the current locale, in that locale's order: use locale; @@ -516,8 +518,9 @@ results, and so always obey the current C locale. In the scope of S>, Perl obeys the C locale setting. This controls the application's notion of which characters are alphabetic. This affects Perl's C<\w> regular expression metanotation, -which stands for alphanumeric characters--that is, alphabetic and -numeric characters. (Consult L for more information about +which stands for alphanumeric characters--that is, alphabetic, +numeric, and including other special characters such as the underscore or +hyphen. (Consult L for more information about regular expressions.) Thanks to C, depending on your locale setting, characters like 'E', 'E', 'E', and 'E' may be understood as C<\w> characters. @@ -606,8 +609,12 @@ obeys the current C locale. The remaining locale category, C (possibly supplemented by others in particular implementations) is not currently used by -Perl--except possibly to affect the behavior of library functions called -by extensions outside the standard Perl distribution. +Perl--except possibly to affect the behavior of library functions +called by extensions outside the standard Perl distribution and by the +operating system and its utilities. Note especially that the string +value of C<$!> and the error messages given by external utilities may +be changed by C. If you want to have portable error +codes, use C<%!>. See L. =head1 SECURITY @@ -635,11 +642,12 @@ case-mapping table is in effect. =item * -If the decimal point character in the C locale is -surreptitiously changed from a dot to a comma, C produces a string result of "123,456". Many people would -interpret this as one hundred and twenty-three thousand, four hundred -and fifty-six. +Some systems are broken in that they allow the "C" locale to be +overridden by users. If the decimal point character in the +C category of the "C" locale is surreptitiously changed +from a dot to a comma, C produces a +string result of "123,456". Many people would interpret this as +one hundred and twenty-three thousand, four hundred and fifty-six. =item * @@ -708,10 +716,6 @@ if modified as a result of a substitution based on a regular expression match involving C<\w>, C<\W>, C<\s>, or C<\S>; or of case-mapping with C<\l>, C<\L>,C<\u> or C<\U>. -=item B (sprintf()): - -Result is tainted if C is in effect. - =item B (printf() and write()): Success/failure result is never tainted. @@ -785,9 +789,10 @@ of a match involving C<\w> while C is in effect. 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. +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. B: PERL_BADLANG only gives you a way to hide the warning message. The message tells about some problem in your system's locale support, @@ -806,6 +811,20 @@ for controlling an application's opinion on data. C is the "override-all" locale environment variable. If set, it overrides all the rest of the locale environment variables. +=item LANGUAGE + +B: C is a GNU extension, it affects you only if you +are using the GNU libc. This is the case if you are using e.g. Linux. +If you are using "commercial" UNIXes you are most probably I +using GNU libc and you can ignore C. + +However, in the case you are using C: it affects the +language of informational, warning, and error messages output by +commands (in other words, it's like C) but it has higher +priority than L. Moreover, it's not a single value but +instead a "path" (":"-separated list) of I (not locales). +See the GNU C library documentation for more information. + =item LC_CTYPE In the absence of C, C chooses the character type @@ -854,7 +873,7 @@ always in force, even if the program environment suggested otherwise (see L). By default, Perl still behaves this way for backward compatibility. If you want a Perl application to pay attention to locale information, you B use the S> -pragma (see L) to instruct it to do so. +pragma (see L) to instruct it to do so. Versions of Perl from 5.002 to 5.003 did use the C information if available; that is, C<\w> did understand what @@ -935,37 +954,12 @@ operating system upgrade. =head1 SEE ALSO -L - -L - -L - -L - -L - -L, - -L - -L - -L, - -L - -L - -L, - -L - -L - -L, - -L +L, L, L, +L, L, L, +L, L, L, +L, L, L, +L, L, L, +L. =head1 HISTORY