Home | MIME::Body | MIME::Decoder | MIME::Entity | MIME::Head |
MIME::IO | MIME::Latin1 | MIME::Parser | MIME::ParserBase | |
MIME::ToolUtils |
MIME::
|
use MIME::Latin1 qw(latin1_to_ascii); $dirty = "Fran\347ois"; print latin1_to_ascii($dirty); # prints out "Fran\c,ois"
"7bit"
encoder/decoder for handling the case where a user wants to 7bit-encode a
document that contains 8-bit (presumably Latin-1) characters.
\xy
Where xy
is a two-character sequence that visually approximates the Latin-1
character. For example:
c cedilla => \c, n tilde => \n~ AE ligature => \AE small o slash => \o/
The sequences are taken almost exactly from the Sun character composition sequences for generating these characters. The translation may be further tweaked by the OPTS string:
If no OPTS string is given,
only 8-bit characters are affected, and their output is of the form \xy
:
\<<Fran\c,ois M\u"ller\>> c:\usr\games
If the OPTS string contains 'NOSLASH',
then the leading "\"
is not output, and the output is more compact:
<<Franc,ois Mu"ller>> c:\usr\games
If the OPTS string contains 'ENCODE',
then not only is the leading "\"
output, but any other occurences of "\"
are escaped as well by turning them into "\\"
. This produces output which may easily be parsed and turned back into the
original 8-bit characters, so in a way it is its own full-fledged
encoding... and given that "\"
is a rare-enough character, not much uglier that the normal output:
\<<Fran\c,ois M\u"ller\>> c:\\usr\\games
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.