Encode::PerlIO 5.8.1
Sponsored Links
Encode::PerlIO 5.8.1 Ranking & Summary
File size:
11.3 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
811
Date added:
2007-08-07
Publisher:
Perl Team
Encode::PerlIO 5.8.1 description
Encode::PerlIO is a detailed document on Encode and PerlIO.
Overview
It is very common to want to do encoding transformations when reading or writing files, network connections, pipes etc. If Perl is configured to use the new perlio IO system then Encode provides a "layer" (see PerlIO) which can transform data as it is read or written.
Here is how the blind poet would modernise the encoding:
use Encode;
open(my $iliad,<:encoding(iso-8859-7),iliad.greek);
open(my $utf8,>:utf8,iliad.utf8);
my @epic = < $iliad >;
print $utf8 @epic;
close($utf8);
close($illiad);
In addition, the new IO system can also be configured to read/write UTF-8 encoded characters (as noted above, this is efficient):
open(my $fh,>:utf8,anything);
print $fh "Any x{0021} string N{SMILEY FACE}n";
Either of the above forms of "layer" specifications can be made the default for a lexical scope with the use open ... pragma. See open.
Once a handle is open, its layers can be altered using binmode.
Without any such configuration, or if Perl itself is built using the systems own IO, then write operations assume that the file handle accepts only bytes and will die if a character larger than 255 is written to the handle. When reading, each octet from the handle becomes a byte-in-a-character. Note that this default is the same behaviour as bytes-only languages (including Perl before v5.6) would have, and is sufficient to handle native 8-bit encodings e.g. iso-8859-1, EBCDIC etc. and any legacy mechanisms for handling other encodings and binary data.
In other cases, it is the programs responsibility to transform characters into bytes using the API above before doing writes, and to transform the bytes read from a handle into characters before doing "character operations" (e.g. lc, /W+/, ...).
You can also use PerlIO to convert larger amounts of data you dont want to bring into memory. For example, to convert between ISO-8859-1 (Latin 1) and UTF-8 (or UTF-EBCDIC in EBCDIC machines):
open(F, "<:encoding(iso-8859-1)", "data.txt") or die $!;
open(G, ">:utf8", "data.utf") or die $!;
while (< F >) { print G }
# Could also do "print G < F >" but that would pull
# the whole file into memory just to write it out again.
More examples:
open(my $f, "<:encoding(cp1252)")
open(my $g, ">:encoding(iso-8859-2)")
open(my $h, ">:encoding(latin9)") # iso-8859-15
Overview
It is very common to want to do encoding transformations when reading or writing files, network connections, pipes etc. If Perl is configured to use the new perlio IO system then Encode provides a "layer" (see PerlIO) which can transform data as it is read or written.
Here is how the blind poet would modernise the encoding:
use Encode;
open(my $iliad,<:encoding(iso-8859-7),iliad.greek);
open(my $utf8,>:utf8,iliad.utf8);
my @epic = < $iliad >;
print $utf8 @epic;
close($utf8);
close($illiad);
In addition, the new IO system can also be configured to read/write UTF-8 encoded characters (as noted above, this is efficient):
open(my $fh,>:utf8,anything);
print $fh "Any x{0021} string N{SMILEY FACE}n";
Either of the above forms of "layer" specifications can be made the default for a lexical scope with the use open ... pragma. See open.
Once a handle is open, its layers can be altered using binmode.
Without any such configuration, or if Perl itself is built using the systems own IO, then write operations assume that the file handle accepts only bytes and will die if a character larger than 255 is written to the handle. When reading, each octet from the handle becomes a byte-in-a-character. Note that this default is the same behaviour as bytes-only languages (including Perl before v5.6) would have, and is sufficient to handle native 8-bit encodings e.g. iso-8859-1, EBCDIC etc. and any legacy mechanisms for handling other encodings and binary data.
In other cases, it is the programs responsibility to transform characters into bytes using the API above before doing writes, and to transform the bytes read from a handle into characters before doing "character operations" (e.g. lc, /W+/, ...).
You can also use PerlIO to convert larger amounts of data you dont want to bring into memory. For example, to convert between ISO-8859-1 (Latin 1) and UTF-8 (or UTF-EBCDIC in EBCDIC machines):
open(F, "<:encoding(iso-8859-1)", "data.txt") or die $!;
open(G, ">:utf8", "data.utf") or die $!;
while (< F >) { print G }
# Could also do "print G < F >" but that would pull
# the whole file into memory just to write it out again.
More examples:
open(my $f, "<:encoding(cp1252)")
open(my $g, ">:encoding(iso-8859-2)")
open(my $h, ">:encoding(latin9)") # iso-8859-15
Encode::PerlIO 5.8.1 Screenshot
Encode::PerlIO 5.8.1 Keywords
PerlIO
PerlIO 5.8.1
EBCDIC
IO
UTF
open
encode
handle
print
f
document
Encode::PerlIO
EncodePerlIO
Encode::PerlIO 5.8.1
Libraries
Programming
Bookmark Encode::PerlIO 5.8.1
Encode::PerlIO 5.8.1 Copyright
WareSeeker periodically updates pricing and software information of Encode::PerlIO 5.8.1 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Encode::PerlIO 5.8.1 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
Encode is a Perl module created to deal with character encodings. Free Download
PerlIO is a Perl module created to load on demand PerlIO layers and root of PerlIO::* name space. Free Download
Encode::RAD50 is a Perl module that can convert to and from the Rad50 character set. Free Download
Open IT Online will improve your browser's capability greatly. It is designed as a Firefox addon that allows to open and edit your documents from everywhere! Free Download
Encode::MIME::Header is a Perl module that contains MIME B and Q header encoding. Free Download
Etterlog is the log analyzer for logfiles created by ettercap. Free Download
JGraphpad is a diagram editor for Swing that offers the functionality to create flow charts, maps, and UML diagrams. Free Download
Devel::Hints is a Perl module created to access compile-time hints at runtime. Free Download
Latest Software
Popular Software
Favourite Software