1package PerlIO::encoding; 2use strict; 3our $VERSION = '0.07'; 4our $DEBUG = 0; 5$DEBUG and warn __PACKAGE__, " called by ", join(", ", caller), "\n"; 6 7# 8# Equivalent of this is done in encoding.xs - do not uncomment. 9# 10# use Encode (); 11 12use XSLoader (); 13XSLoader::load(__PACKAGE__, $VERSION); 14 15our $fallback = Encode::PERLQQ()|Encode::WARN_ON_ERR(); 16 171; 18__END__ 19 20=head1 NAME 21 22PerlIO::encoding - encoding layer 23 24=head1 SYNOPSIS 25 26 open($f, "<:encoding(foo)", "infoo"); 27 open($f, ">:encoding(bar)", "outbar"); 28 29 use Encode qw(:fallbacks); 30 $PerlIO::encoding::fallback = FB_PERLQQ; 31 32=head1 DESCRIPTION 33 34Open a filehandle with a transparent encoding filter. 35 36On input, convert the bytes expected to be in the specified 37character set and encoding to Perl string data (Unicode and 38Perl's internal Unicode encoding, UTF-8). On output, convert 39Perl string data into the specified character set and encoding. 40 41When the layer is pushed the current value of C<$PerlIO::encoding::fallback> 42is saved and used as the check argument when calling the Encodings 43encode and decode. 44 45=head1 SEE ALSO 46 47L<open>, L<Encode>, L<perlfunc/binmode>, L<perluniintro> 48 49=cut 50 51