This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
put signature ops in their own subtree.
[perl5.git] / ext / PerlIO-encoding / encoding.pm
CommitLineData
59035dcc 1package PerlIO::encoding;
4b6f7c81 2
c657f685 3use strict;
06cc5386 4our $VERSION = '0.28';
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
da4061d3
NC
13require XSLoader;
14XSLoader::load();
c657f685 15
56ff7374 16our $fallback =
7d0a46b7 17 Encode::PERLQQ()|Encode::WARN_ON_ERR()|Encode::ONLY_PRAGMA_WARNINGS()|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
51dfe3f7
RGS
28 use PerlIO::encoding;
29
b89cebd3
JH
30 open($f, "<:encoding(foo)", "infoo");
31 open($f, ">:encoding(bar)", "outbar");
59035dcc 32
c657f685 33 use Encode qw(:fallbacks);
e7e5539a 34 $PerlIO::encoding::fallback = FB_PERLQQ;
c00aecee 35
59035dcc
JH
36=head1 DESCRIPTION
37
51dfe3f7 38This PerlIO layer opens a filehandle with a transparent encoding filter.
b89cebd3 39
51dfe3f7 40On input, it converts the bytes expected to be in the specified
b89cebd3 41character set and encoding to Perl string data (Unicode and
51dfe3f7 42Perl's internal Unicode encoding, UTF-8). On output, it converts
b89cebd3
JH
43Perl string data into the specified character set and encoding.
44
51dfe3f7
RGS
45When the layer is pushed, the current value of C<$PerlIO::encoding::fallback>
46is saved and used as the CHECK argument when calling the Encode methods
47encode() and decode().
c00aecee 48
b89cebd3
JH
49=head1 SEE ALSO
50
51L<open>, L<Encode>, L<perlfunc/binmode>, L<perluniintro>
2dc05cb3 52
59035dcc 53=cut