From ec90690f0842364bbbf48a984e7382b2d660d09d Mon Sep 17 00:00:00 2001 From: SADAHIRO Tomoyuki Date: Sun, 19 May 2002 10:01:58 +0900 Subject: [Patch] doc patch on Unicode Message-Id: <20020519005515.18F0.BQW10602@nifty.com> p4raw-id: //depot/perl@16676 --- pod/perluniintro.pod | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'pod/perluniintro.pod') diff --git a/pod/perluniintro.pod b/pod/perluniintro.pod index d6eae60c4b..743d4ed916 100644 --- a/pod/perluniintro.pod +++ b/pod/perluniintro.pod @@ -302,17 +302,23 @@ To ensure that the output is explicitly rendered in the encoding you desire (and to avoid the warning), open the stream with the desired encoding. Some examples: - open FH, ">:ucs2", "file" - open FH, ">:utf8", "file"; - open FH, ">:Shift-JIS", "file"; + open FH, ">:utf8", "file"; + + open FH, ">:encoding(ucs2)", "file"; + open FH, ">:encoding(UTF-8)", "file"; + open FH, ">:encoding(shift_jis)", "file"; and on already open streams use C: - binmode(STDOUT, ":ucs2"); binmode(STDOUT, ":utf8"); - binmode(STDOUT, ":Shift-JIS"); -See documentation for the C module for many supported encodings. + binmode(STDOUT, ":encoding(ucs2)"); + binmode(STDOUT, ":encoding(UTF-8)"); + binmode(STDOUT, ":encoding(shift_jis)"); + +See L for the C<:utf8> layer; +L and L for the C<:encoding()> layer; +L for many encodings supported by the C module. Reading in a file that you know happens to be encoded in one of the Unicode encodings does not magically turn the data into Unicode in @@ -322,7 +328,7 @@ opening files open(my $fh,'<:utf8', 'anything'); my $line_of_unicode = <$fh>; - open(my $fh,'<:Big5', 'anything'); + open(my $fh,'<:encoding(Big5)', 'anything'); my $line_of_unicode = <$fh>; The I/O disciplines can also be specified more flexibly with -- cgit v1.2.1