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