diff options
author | SADAHIRO Tomoyuki <BQW10602@nifty.com> | 2002-05-19 10:01:58 +0900 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-05-18 15:40:35 +0000 |
commit | 60aba854bc7cd5a18857bba6462adef452074d18 (patch) | |
tree | 5f95a6c7952bff14b75a9b38a6d3e9bc60967e0c /pod/perluniintro.pod | |
parent | 2d40acd2398208962b6f24f4a9a4d50e8a966d2e (diff) | |
download | perl-60aba854bc7cd5a18857bba6462adef452074d18.tar.gz |
[Patch] doc patch on Unicode
Message-Id: <20020519005515.18F0.BQW10602@nifty.com>
p4raw-id: //depot/perl@16676
Diffstat (limited to 'pod/perluniintro.pod')
-rw-r--r-- | pod/perluniintro.pod | 20 |
1 files changed, 13 insertions, 7 deletions
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()>: - binmode(STDOUT, ":ucs2"); binmode(STDOUT, ":utf8"); - binmode(STDOUT, ":Shift-JIS"); -See documentation for the C<Encode> module for many supported encodings. + binmode(STDOUT, ":encoding(ucs2)"); + binmode(STDOUT, ":encoding(UTF-8)"); + binmode(STDOUT, ":encoding(shift_jis)"); + +See L<PerlIO> for the C<:utf8> layer; +L<PerlIO::encoding> and L<Encode::PerlIO> for the C<:encoding()> layer; +L<Encode::Supported> for many encodings supported by the C<Encode> 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 |