summaryrefslogtreecommitdiff
path: root/lib/open.pm
diff options
context:
space:
mode:
authorJuerd Waalboer <#####@juerd.nl>2007-11-17 21:03:00 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-11-23 10:58:24 +0000
commit740d4bb23b722729f87a23733be98429529fd900 (patch)
tree878b0c5b967bc4472bfe693ee737fb9c2c218019 /lib/open.pm
parente056e17d86381d9e7aef09f26f070da3695a94b4 (diff)
downloadperl-740d4bb23b722729f87a23733be98429529fd900.tar.gz
[patch] :utf8 updates
Message-ID: <20071117190300.GY10696@c4.convolution.nl> p4raw-id: //depot/perl@32461
Diffstat (limited to 'lib/open.pm')
-rw-r--r--lib/open.pm23
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/open.pm b/lib/open.pm
index d384b419c8..6415a0880a 100644
--- a/lib/open.pm
+++ b/lib/open.pm
@@ -79,11 +79,7 @@ sub import {
unless defined $locale_encoding;
(warnings::warnif("layer", "Cannot figure out an encoding to use"), last)
unless defined $locale_encoding;
- if ($locale_encoding =~ /^utf-?8$/i) {
- $layer = "utf8";
- } else {
- $layer = "encoding($locale_encoding)";
- }
+ $layer = "encoding($locale_encoding)";
$std = 1;
} else {
my $target = $layer; # the layer name itself
@@ -151,7 +147,7 @@ open - perl pragma to set default PerlIO layers for input and output
use open IO => ':locale';
- use open ':utf8';
+ use open ':encoding(utf8)';
use open ':locale';
use open ':encoding(iso-8859-7)';
@@ -193,8 +189,8 @@ For example:
These are equivalent
- use open ':utf8';
- use open IO => ':utf8';
+ use open ':encoding(utf8)';
+ use open IO => ':encoding(utf8)';
as are these
@@ -210,9 +206,6 @@ The matching of encoding names is loose: case does not matter, and
many encodings have several aliases. See L<Encode::Supported> for
details and the list of supported locales.
-Note that C<:utf8> PerlIO layer must always be specified exactly like
-that, it is not subject to the loose matching of encoding names.
-
When open() is given an explicit list of layers (with the three-arg
syntax), they override the list declared using this pragma.
@@ -220,10 +213,10 @@ The C<:std> subpragma on its own has no effect, but if combined with
the C<:utf8> or C<:encoding> subpragmas, it converts the standard
filehandles (STDIN, STDOUT, STDERR) to comply with encoding selected
for input/output handles. For example, if both input and out are
-chosen to be C<:utf8>, a C<:std> will mean that STDIN, STDOUT, and
-STDERR are also in C<:utf8>. On the other hand, if only output is
-chosen to be in C<< :encoding(koi8r) >>, a C<:std> will cause only the
-STDOUT and STDERR to be in C<koi8r>. The C<:locale> subpragma
+chosen to be C<:encoding(utf8)>, a C<:std> will mean that STDIN, STDOUT,
+and STDERR are also in C<:encoding(utf8)>. On the other hand, if only
+output is chosen to be in C<< :encoding(koi8r) >>, a C<:std> will cause
+only the STDOUT and STDERR to be in C<koi8r>. The C<:locale> subpragma
implicitly turns on C<:std>.
The logic of C<:locale> is described in full in L<encoding>,