diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-08-12 14:16:44 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-08-12 14:16:44 +0000 |
commit | ad0029c435199eaf70c06265f639c1af50f36906 (patch) | |
tree | 1c5cb5b923db2505a17d89f8374aad419d5bcb1d /pod | |
parent | 9e1b5a4e54e5c46a7023c503b5749aa9998420a2 (diff) | |
download | perl-ad0029c435199eaf70c06265f639c1af50f36906.tar.gz |
Dispell the "use utf8" superstition.
p4raw-id: //depot/perl@11643
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlfunc.pod | 41 | ||||
-rw-r--r-- | pod/perlretut.pod | 17 | ||||
-rw-r--r-- | pod/perltoc.pod | 88 | ||||
-rw-r--r-- | pod/perlunicode.pod | 8 |
4 files changed, 120 insertions, 34 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 4a76999096..56937f4ddf 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -682,9 +682,9 @@ On POSIX systems, you can detect this condition this way: Returns the character represented by that NUMBER in the character set. For example, C<chr(65)> is C<"A"> in either ASCII or Unicode, and -chr(0x263a) is a Unicode smiley face. Within the scope of C<use utf8>, -characters higher than 127 are encoded in Unicode; if you don't want -this, temporarily C<use bytes> or use C<pack("C*",...)> +chr(0x263a) is a Unicode smiley face. Note that characters from +127 to 255 (inclusive) are not encoded in Unicode for backward +compatibility reasons. For the reverse, use L</ord>. See L<utf8> for more about Unicode. @@ -2310,9 +2310,9 @@ C<redo> work. =item lc Returns an lowercased version of EXPR. This is the internal function -implementing the C<\L> escape in double-quoted strings. -Respects current LC_CTYPE locale if C<use locale> in force. See L<perllocale> -and L<utf8>. +implementing the C<\L> escape in double-quoted strings. Respects +current LC_CTYPE locale if C<use locale> in force. See L<perllocale> +and L<perlunicode>. If EXPR is omitted, uses C<$_>. @@ -2320,9 +2320,10 @@ If EXPR is omitted, uses C<$_>. =item lcfirst -Returns the value of EXPR with the first character lowercased. This is -the internal function implementing the C<\l> escape in double-quoted strings. -Respects current LC_CTYPE locale if C<use locale> in force. See L<perllocale>. +Returns the value of EXPR with the first character lowercased. This +is the internal function implementing the C<\l> escape in +double-quoted strings. Respects current LC_CTYPE locale if C<use +locale> in force. See L<perllocale> and L<perlunicode>. If EXPR is omitted, uses C<$_>. @@ -3080,8 +3081,8 @@ follows: P A pointer to a structure (fixed-length string). u A uuencoded string. - U A Unicode character number. Encodes to UTF-8 internally. - Works even if C<use utf8> is not in effect. + U A Unicode character number. Encodes to UTF-8 internally + (or UTF-EBCDIC in EBCDIC platforms). w A BER compressed integer. Its bytes represent an unsigned integer in base 128, most significant digit first, with as @@ -5367,10 +5368,11 @@ otherwise. =item uc Returns an uppercased version of EXPR. This is the internal function -implementing the C<\U> escape in double-quoted strings. -Respects current LC_CTYPE locale if C<use locale> in force. See L<perllocale>. -Under Unicode (C<use utf8>) it uses the standard Unicode uppercase mappings. (It -does not attempt to do titlecase mapping on initial letters. See C<ucfirst> for that.) +implementing the C<\U> escape in double-quoted strings. Respects +current LC_CTYPE locale if C<use locale> in force. See L<perllocale> +and L<perlunicode>. Under Unicode it uses the standard Unicode +uppercase mappings. (It does not attempt to do titlecase mapping on +initial letters. See C<ucfirst> for that.) If EXPR is omitted, uses C<$_>. @@ -5378,11 +5380,10 @@ If EXPR is omitted, uses C<$_>. =item ucfirst -Returns the value of EXPR with the first character -in uppercase (titlecase in Unicode). This is -the internal function implementing the C<\u> escape in double-quoted strings. -Respects current LC_CTYPE locale if C<use locale> in force. See L<perllocale> -and L<utf8>. +Returns the value of EXPR with the first character in uppercase +(titlecase in Unicode). This is the internal function implementing +the C<\u> escape in double-quoted strings. Respects current LC_CTYPE +locale if C<use locale> in force. See L<perllocale> and L<perlunicode>. If EXPR is omitted, uses C<$_>. diff --git a/pod/perlretut.pod b/pod/perlretut.pod index acb95cd01f..95e3f03432 100644 --- a/pod/perlretut.pod +++ b/pod/perlretut.pod @@ -1647,13 +1647,18 @@ sequence of bytes (the old way) or as a sequence of Unicode characters than C<chr(127)> may be represented using the C<\x{hex}> notation, with C<hex> a hexadecimal integer: - use utf8; # We will be doing Unicode processing /\x{263a}/; # match a Unicode smiley face :) Unicode characters in the range of 128-255 use two hexadecimal digits with braces: C<\x{ab}>. Note that this is different than C<\xab>, -which is just a hexadecimal byte with no Unicode -significance. +which is just a hexadecimal byte with no Unicode significance. + +B<NOTE>: in perl 5.6.0 it used to be that one needed to say C<use utf8> +to use any Unicode features. This is no more the case: for almost all +Unicode processing, the explicit C<utf8> pragma is not needed. +(The only case where it matters is if your Perl script is in Unicode, +that is, encoded in UTF-8/UTF-16/UTF-EBCDIC: then an explicit C<use utf8> +is needed.) Figuring out the hexadecimal sequence of a Unicode character you want or deciphering someone else's hexadecimal Unicode regexp is about as @@ -1664,15 +1669,12 @@ specified in the Unicode standard. For instance, if we wanted to represent or match the astrological sign for the planet Mercury, we could use - use utf8; # We will be doing Unicode processing use charnames ":full"; # use named chars with Unicode full names $x = "abc\N{MERCURY}def"; $x =~ /\N{MERCURY}/; # matches One can also use short names or restrict names to a certain alphabet: - use utf8; # We will be doing Unicode processing - use charnames ':full'; print "\N{GREEK SMALL LETTER SIGMA} is called sigma.\n"; @@ -1693,7 +1695,6 @@ characters, but matching a single byte is required, we can use the C<\C> escape sequence. C<\C> is a character class akin to C<.> except that it matches I<any> byte 0-255. So - use utf8; # We will be doing Unicode processing use charnames ":full"; # use named chars with Unicode full names $x = "a"; $x =~ /\C/; # matches 'a', eats one byte @@ -1715,7 +1716,6 @@ the C<\P{name}> character class, which is the negation of the C<\p{name}> class. For example, to match lower and uppercase characters, - use utf8; # We will be doing Unicode processing use charnames ":full"; # use named chars with Unicode full names $x = "BOB"; $x =~ /^\p{IsUpper}/; # matches, uppercase char class @@ -1788,7 +1788,6 @@ be used just like C<\d>, both inside and outside of character classes: /\s+[abc[:digit:]xyz]\s*/; # match a,b,c,x,y,z, or a digit /^=item\s[:digit:]/; # match '=item', # followed by a space and a digit - use utf8; use charnames ":full"; /\s+[abc\p{IsDigit}xyz]\s+/; # match a,b,c,x,y,z, or a digit /^=item\s\p{IsDigit}/; # match '=item', diff --git a/pod/perltoc.pod b/pod/perltoc.pod index a250c6191d..a0960bbc21 100644 --- a/pod/perltoc.pod +++ b/pod/perltoc.pod @@ -1992,7 +1992,7 @@ LC_NUMERIC, LC_TIME, LANG =item Important Caveats Input and Output Disciplines, Regular Expressions, C<use utf8> still needed -to enable a few features +to enable UTF-8/UTF-EBCDIC in scripts =item Byte and Character semantics @@ -6003,6 +6003,50 @@ Source, Compiled Module Source, Perl Modules/Scripts =back +=head2 perldos - Perl under DOS, W31, W95. + +=over 4 + +=item SYNOPSIS + +=item DESCRIPTION + +=over 4 + +=item Prerequisites for Compiling Perl on DOS + +DJGPP, Pthreads + +=item Shortcomings of Perl under DOS + +=item Building Perl on DOS + +=item Testing Perl on DOS + +=item Installation of Perl on DOS + +=back + +=item BUILDING AND INSTALLING MODULES ON DOS + +=over 4 + +=item Building Prerequisites for Perl on DOS + +=item Unpacking CPAN Modules on DOS + +=item Building Non-XS Modules on DOS + +=item Building XS Modules on DOS + +=back + +=item AUTHOR + +=item SEE ALSO + +=back + =head2 perlepoc, README.epoc - Perl for EPOC =over 4 @@ -6873,6 +6917,48 @@ LIST, waitpid PID,FLAGS =back +=head2 perlwin32 - Perl under Win32 + +=over 4 + +=item SYNOPSIS + +=item DESCRIPTION + +=over 4 + +=item Setting Up Perl on Win32 + +Make, Command Shell, Borland C++, Microsoft Visual C++, Mingw32 with GCC + +=item Building + +=item Testing Perl on Win32 + +=item Installation of Perl on Win32 + +=item Usage Hints for Perl on Win32 + +Environment Variables, File Globbing, Using perl from the command line, +Building Extensions, Command-line Wildcard Expansion, Win32 Specific +Extensions, Running Perl Scripts, Miscellaneous Things + +=back + +=item BUGS AND CAVEATS + +=item AUTHORS + +Gary Ng E<lt>71564.1743@CompuServe.COME<gt>, Gurusamy Sarathy +E<lt>gsar@activestate.comE<gt>, Nick Ing-Simmons +E<lt>nick@ing-simmons.netE<gt> + +=item SEE ALSO + +=item HISTORY + +=back + =head1 PRAGMA DOCUMENTATION =head2 attrs - set/get attributes of a subroutine (deprecated) diff --git a/pod/perlunicode.pod b/pod/perlunicode.pod index 914ce04260..f429be74b2 100644 --- a/pod/perlunicode.pod +++ b/pod/perlunicode.pod @@ -40,16 +40,16 @@ presented with Unicode data, or a traditional byte scheme when presented with byte data. The implementation is still new and (particularly on EBCDIC platforms) may need further work. -=item C<use utf8> still needed to enable a few features +=item C<use utf8> still needed to enable UTF-8/UTF-EBCDIC in scripts The C<utf8> pragma implements the tables used for Unicode support. These tables are automatically loaded on demand, so the C<utf8> pragma need not normally be used. However, as a compatibility measure, this pragma must be explicitly -used to enable recognition of UTF-8 encoded literals and identifiers -in the source text on ASCII based machines or recognize UTF-EBCDIC -encoded literals and identifiers on EBCDIC based machines. +used to enable recognition of UTF-8 in the Perl scripts themselves on +ASCII based machines or recognize UTF-EBCDIC on EBCDIC based machines. +B<This should be the only place where an explicit C<use utf8> is needed>. =back |