perllocale: Clean up recent additions
authorTom Christiansen <tchrist@perl.com>
Thu, 14 Apr 2011 16:30:18 +0000 (10:30 -0600)
committerKarl Williamson <public@khwilliamson.com>
Thu, 14 Apr 2011 16:33:56 +0000 (10:33 -0600)
pod/perllocale.pod

index 030ec75..462194b 100644 (file)
@@ -12,8 +12,8 @@ a letter", "what is the uppercase equivalent of this letter", and
 "which of these letters comes first".  These are important issues,
 especially for languages other than English--but also for English: it
 would be naE<iuml>ve to imagine that C<A-Za-z> defines all the "letters"
-needed to write in English. Perl is also aware that some character other
-than '.' may be preferred as a decimal point, and that output date
+needed to write correct English. Perl is also aware that some character other
+than "." may be preferred as a decimal point, and that output date
 representations may be language-specific.  The process of making an
 application take account of its users' preferences in such matters is
 called B<internationalization> (often abbreviated as B<i18n>); telling
@@ -468,9 +468,9 @@ basic category at a time.  See L<"ENVIRONMENT"> for a discussion of these.
 
 In the scope of S<C<use locale>>, Perl looks to the C<LC_COLLATE>
 environment variable to determine the application's notions on collation
-(ordering) of characters.  For example, 'b' follows 'a' in Latin
-alphabets, but where do 'E<aacute>' and 'E<aring>' belong?  And while
-'color' follows 'chocolate' in English, what about in Spanish?
+(ordering) of characters.  For example, "b" follows "a" in Latin
+alphabets, but where do "E<aacute>" and "E<aring>" belong?  And while
+"color" follows "chocolate" in English, what about in Spanish?
 
 The following collations all make sense and you may meet any of them
 if you "use locale".
@@ -553,8 +553,8 @@ which stands for alphanumeric characters--that is, alphabetic,
 numeric, and including other special characters such as the underscore or
 hyphen.  (Consult L<perlre> for more information about
 regular expressions.)  Thanks to C<LC_CTYPE>, depending on your locale
-setting, characters like 'E<aelig>', 'E<eth>', 'E<szlig>', and
-'E<oslash>' may be understood as C<\w> characters.
+setting, characters like "E<aelig>", "E<eth>", "E<szlig>", and
+"E<oslash>" may be understood as C<\w> characters.
 
 The C<LC_CTYPE> locale also provides the map used in transliterating
 characters between lower and uppercase.  This affects the case-mapping
@@ -581,7 +581,7 @@ locale information, which controls an application's idea of how numbers
 should be formatted for human readability by the printf(), sprintf(), and
 write() functions. String-to-numeric conversion by the POSIX::strtod()
 function is also affected.  In most implementations the only effect is to
-change the character used for the decimal point--perhaps from '.'  to ','.
+change the character used for the decimal point--perhaps from "."  to ",".
 These functions aren't aware of such niceties as thousands separation and
 so on. (See L<The localeconv function> if you care about these things.)
 
@@ -1007,13 +1007,13 @@ into bankers, bikers, gamers, and so on.
 =head1 Unicode and UTF-8
 
 The support of Unicode is new starting from Perl version 5.6, and more fully
-implemented in version 5.8, and later.  See L<perluniintro>.  Perl tries to
-work with both Unicode and locales.  But, of course, there are problems.
+implemented in version 5.8 and later.  See L<perluniintro>.  Perl tries to
+work with both Unicode and locales--but of course, there are problems.
 
 Perl does not handle multi-byte locales, such as have been used for various
-Asian languages, such as Big5 or Shift JIS.  However, the multi-byte,
-increasingly common, UTF-8 locales, if properly implemented, tend to work
-reasonably well in Perl, simply because both they and Perl store the
+Asian languages, such as Big5 or Shift JIS.  However, the increasingly common
+multi-byte UTF-8 locales, if properly implemented, tend to work
+reasonably well in Perl, simply because both they and Perl store
 characters that take up multiple bytes the same way.
 
 Perl generally takes the tack to use locale rules on code points that can fit
@@ -1022,37 +1022,41 @@ uniformly applied prior to Perl 5.14).  This prevents many problems in locales
 that aren't UTF-8.  Suppose the locale is ISO8859-7, Greek.  The character at
 0xD7 there is a capital Chi. But in the ISO8859-1 locale, Latin1, it is a
 multiplication sign.  The POSIX regular expression character class
-C<[[:alpha:]]> will magically match 0xD7 in the Greek locale, but not in the
-Latin, even if the string is encoded in UTF-8, which normally would imply
-Unicode.  (The "U" in UTF-8 stands for Unicode.)
+C<[[:alpha:]]> will magically match 0xD7 in the Greek locale but not in the
+Latin one, even if the string is encoded in UTF-8, which would normally imply
+Unicode semantics.  (The "U" in UTF-8 stands for Unicode.)
 
 However, there are places where this breaks down.  Certain constructs are
-for Unicode only, such as C<\p{Alpha}>.  They assume that 0xD7 always has the
-Unicode meaning (or its equivalent on EBCDIC platforms).  Since Latin1 is a
-subset of Unicode, 0xD7 is the multiplication sign in Unicode, so C<\p{Alpha}>
-will not match it, regardless of locale.  A similar issue happens with
-C<\N{...}>.  Therefore, it is a bad idea to use C<\p{}> or C<\N{}> under
-locale unless you know that the locale is always going to be ISO8859-1 or a
-UTF-8 one.  Use the POSIX character classes instead.
+for Unicode only, such as C<\p{Alpha}>.  They assume that 0xD7 always has its
+Unicode meaning (or the equivalent on EBCDIC platforms).  Since Latin1 is a
+subset of Unicode and 0xD7 is the multiplication sign in both Latin1 and
+Unicode, C<\p{Alpha}> will never match it, regardless of locale.  A similar
+issue occurs with C<\N{...}>.  It is therefore a bad idea to use C<\p{}> or
+C<\N{}> under C<use locale>--I<unless> you can guarantee that the locale will
+be a ISO8859-1 or UTF-8 one.  Use POSIX character classes instead.
+
 
 The same problem ensues if you enable automatic UTF-8-ification of your
 standard file handles, default C<open()> layer, and C<@ARGV> on non-ISO8859-1,
-non-UTF-8 locales (by using either the C<-C> command line switch or the
-C<PERL_UNICODE> environment variable; see L<perlrun> for the documentation of
-the C<-C> switch).  Things are read in as UTF-8 which would normally imply a
-Unicode interpretation, but the presence of locale causes them to be
-interpreted in that locale, so a 0xD7 code point in the input will have meant
-the multiplication sign, but won't be interpreted by Perl that way in the
-Greek locale.  Again, this is not a problem if you know that the locales are
-always going to be ISO8859-1 or UTF-8.
-
-Vendor locales are notoriously buggy, and it is difficult for Perl to
-test its locale handling code because it interacts with code that Perl
-has no control over, therefore the local handling code in Perl may be buggy
-as well.  But if you do have locales that work, it may be worthwhile using
-them, keeping in mind the gotchas already mentioned.  Locale collation
-is faster than L<Unicode::Collate>, for example, and you gain access
-to things such as the currency symbol and days of the week.
+non-UTF-8 locales (by using either the B<-C> command line switch or the
+C<PERL_UNICODE> environment variable; see L<perlrun>).
+Things are read in as UTF-8, which would normally imply a Unicode
+interpretation, but the presence of a locale causes them to be interpreted
+in that locale instead.  For example, a 0xD7 code point in the Unicode
+input, which should mean the multiplication sign, won't be interpreted by
+Perl that way under the Greek locale.  Again, this is not a problem
+I<provided> you make certain that all locales will always and only be either
+an ISO8859-1 or a UTF-8 locale.
+
+Vendor locales are notoriously buggy, and it is difficult for Perl to test
+its locale-handling code because this interacts with code that Perl has no
+control over; therefore the locale-handling code in Perl may be buggy as
+well.  But if you I<do> have locales that work, using them may be
+worthwhile for certain specific purposes, as long as you keep in mind the
+gotchas already mentioned.  For example, collation runs faster under
+locales than under L<Unicode::Collate> (albeit with less flexibility), and
+you gain access to such things as the local currency symbol and the names
+of the months and days of the week.
 
 =head1 BUGS
 
@@ -1060,10 +1064,10 @@ to things such as the currency symbol and days of the week.
 
 In certain systems, the operating system's locale support
 is broken and cannot be fixed or used by Perl.  Such deficiencies can
-and will result in mysterious hangs and/or Perl core dumps when the
+and will result in mysterious hangs and/or Perl core dumps when
 C<use locale> is in effect.  When confronted with such a system,
 please report in excruciating detail to <F<perlbug@perl.org>>, and
-complain to your vendor: bug fixes may exist for these problems
+also contact your vendor: bug fixes may exist for these problems
 in your operating system.  Sometimes such bug fixes are called an
 operating system upgrade.