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