This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Clarify docs
[perl5.git] / ext / PerlIO / encoding / encoding.pm
CommitLineData
59035dcc 1package PerlIO::encoding;
4b6f7c81 2
c657f685 3use strict;
56ff7374 4our $VERSION = '0.09';
c657f685
JH
5our $DEBUG = 0;
6$DEBUG and warn __PACKAGE__, " called by ", join(", ", caller), "\n";
7
8#
1982da40 9# Equivalent of this is done in encoding.xs - do not uncomment.
c657f685 10#
54871a3c 11# use Encode ();
c657f685 12
59035dcc 13use XSLoader ();
c657f685
JH
14XSLoader::load(__PACKAGE__, $VERSION);
15
56ff7374
RGS
16our $fallback =
17 Encode::PERLQQ()|Encode::WARN_ON_ERR()|Encode::STOP_AT_PARTIAL();
1982da40 18
59035dcc
JH
191;
20__END__
21
22=head1 NAME
23
24PerlIO::encoding - encoding layer
25
26=head1 SYNOPSIS
27
b89cebd3
JH
28 open($f, "<:encoding(foo)", "infoo");
29 open($f, ">:encoding(bar)", "outbar");
59035dcc 30
c657f685 31 use Encode qw(:fallbacks);
e7e5539a 32 $PerlIO::encoding::fallback = FB_PERLQQ;
c00aecee 33
59035dcc
JH
34=head1 DESCRIPTION
35
b89cebd3
JH
36Open a filehandle with a transparent encoding filter.
37
38On input, convert the bytes expected to be in the specified
39character set and encoding to Perl string data (Unicode and
40Perl's internal Unicode encoding, UTF-8). On output, convert
41Perl string data into the specified character set and encoding.
42
e7e5539a 43When the layer is pushed the current value of C<$PerlIO::encoding::fallback>
4b6f7c81
RGS
44is saved and used as the CHECK argument when calling the Encode methods encode()
45and decode().
c00aecee 46
b89cebd3
JH
47=head1 SEE ALSO
48
49L<open>, L<Encode>, L<perlfunc/binmode>, L<perluniintro>
2dc05cb3 50
59035dcc 51=cut