NAME

MIME::Latin1 - translate ISO-8859-1 into 7-bit approximations

SYNOPSIS

use MIME::Latin1 qw(latin1_to_ascii);

$dirty = "Fran\347ois";
print latin1_to_ascii($dirty);      # prints out "Fran\c,ois"

DESCRIPTION

This is a small package used by the "7bit" encoder/decoder for handling the case where a user wants to 7bit-encode a document that contains 8-bit (presumably Latin-1) characters.

PUBLIC INTERFACE

latin1_to_ascii STRING,[OPTS]

Map the Latin-1 characters in the string to sequences of the form:

\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

AUTHOR

Copyright (c) 1996 by Eryq / eryq@rhine.gsfc.nasa.gov

All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

VERSION

$Revision: 1.3 $ $Date: 1997/01/03 21:05:13 $