Mention there are places /x modifier is ineffective
[p5sagit/p5-mst-13.2.git] / pod / perlunicode.pod
index 1737b52..ae13a33 100644 (file)
@@ -31,7 +31,7 @@ To indicate that Perl source itself is in UTF-8, use C<use utf8;>.
 The regular expression compiler produces polymorphic opcodes.  That is,
 the pattern adapts to the data and automatically switches to the Unicode
 character scheme when presented with data that is internally encoded in
-UTF-8 -- or instead uses a traditional byte scheme when presented with
+UTF-8, or instead uses a traditional byte scheme when presented with
 byte data.
 
 =item C<use utf8> still needed to enable UTF-8/UTF-EBCDIC in scripts
@@ -146,12 +146,16 @@ If you use a Unicode editor to edit your program, Unicode characters may
 occur directly within the literal strings in UTF-8 encoding, or UTF-16.
 (The former requires a BOM or C<use utf8>, the latter requires a BOM.)
 
-Unicode characters can also be added to a string by using the C<\x{...}>
+Unicode characters can also be added to a string by using the C<\N{U+...}>
 notation.  The Unicode code for the desired character, in hexadecimal,
-should be placed in the braces. For instance, a smiley face is
-C<\x{263A}>.  This encoding scheme works for all characters, but
-for characters under 0x100, note that Perl may use an 8 bit encoding
-internally, for optimization and/or backward compatibility.
+should be placed in the braces, after the C<U>. For instance, a smiley face is
+C<\N{U+263A}>.
+
+Alternatively, you can use the C<\x{...}> notation for characters 0x100 and
+above.  For characters below 0x100 you may get byte semantics instead of
+character semantics;  see L</The "Unicode Bug">.  On EBCDIC machines there is
+the additional problem that the value for such characters gives the EBCDIC
+character rather than the Unicode one.
 
 Additionally, if you
 
@@ -159,6 +163,7 @@ Additionally, if you
 
 you can use the C<\N{...}> notation and put the official Unicode
 character name within the braces, such as C<\N{WHITE SMILING FACE}>.
+See L<charnames>.
 
 =item *
 
@@ -721,14 +726,14 @@ matches as well.
 
 =item B<C<\p{Print}>>
 
-This matches any character that is graphical or is space, but not a control.
+This matches any character that is graphical or blank, except controls.
 
 =item B<C<\p{SpacePerl}>>
 
 This is the same as C<\s>, including beyond ASCII.
 
-Mnemonic: Space, as modified by Perl.  (It doesn't include vertical tab which
-both the Posix standard and Unicode consider to be space.)
+Mnemonic: Space, as modified by Perl.  (It doesn't include the vertical tab
+which both the Posix standard and Unicode consider to be space.)
 
 =item B<C<\p{VertSpace}>>
 
@@ -857,7 +862,7 @@ two (or more) classes.
     END
     }
 
-It's important to remember not to use "&" for the first set -- that
+It's important to remember not to use "&" for the first set; that
 would be intersecting with nothing (resulting in an empty set).
 
 =head2 User-Defined Case Mappings
@@ -1296,7 +1301,7 @@ readdir, readlink
 =head2 The "Unicode Bug"
 
 The term, the "Unicode bug" has been applied to an inconsistency with the
-Unicode characters whose code points are in the Latin-1 Supplement block, that
+Unicode characters whose ordinals are in the Latin-1 Supplement block, that
 is, between 128 and 255.  Without a locale specified, unlike all other
 characters or code points, these characters have very different semantics in
 byte semantics versus character semantics.
@@ -1374,7 +1379,9 @@ operations in the 5.12 release, it is planned to have it affect all the
 problematic behaviors in later releases: you can't have one without them all.
 
 In the meantime, a workaround is to always call utf8::upgrade($string), or to
-use the standard modules L<Encode> or L<charnames>.
+use the standard module L<Encode>.   Also, a scalar that has any characters
+whose ordinal is above 0x100, or which were specified using either of the
+C<\N{...}> notations will automatically have character semantics.
 
 =head2 Forcing Unicode in Perl (Or Unforcing Unicode in Perl)