|
Text::Striphigh - Perl extension to strip the high bit off of ISO-8859-1 text.
|
Text::Striphigh - Perl extension to strip the high bit off of ISO-8859-1 text.
This module is not included with the standard ActivePerl distribution. It is available as a separate download using PPM.
use Text::Striphigh 'striphigh'
$SevenBitsText = striphigh($TextContainingEightBitCharacters);
The Text::Striphigh module exports a single function: striphigh. This
function takes one argument, a string possibly containing high ASCII
characters in the ISO-8859-1 character set, and transforms this into a
string containing only 7 bits ASCII characters, by substituting every
high bit character with a similar looking standard ASCII character, or
with a sequence of standard ASCII characters.
Because of precisely the deficiency this package tries to offer a workaround
for is present in some of the things that process pod, there are no
examples in this manpage. Look at the source or the test script if you
want examples.
If you ever want to change the striphigh function yourself, then don't
change the one containing the mile long tr{}{} statement that you see
at first, change the one behind the __DATA__ that's a lot more readable.
After you've done that, simply run the Striphigh.pm file through perl
to generate a new version of the first routine, and in fact of the entire
file, something like this:
perl -w Striphigh.pm > Striphigh.pm.new
mv Striphigh.pm.new Striphigh.pm
Assumes the input text is ISO-8859-1, without even looking at the LOCALE
settings.
Some translations are probably less than optimal.
People will be offended if you run their names through this function, and
print the result on an envelope using an outdated printing device. However,
it's probably better than having that printer print a name with a high ASCII
character in it which happens to be the command to set the printer on fire.
Jan-Pieter Cornet <johnpc@xs4all.nl>
|
Text::Striphigh - Perl extension to strip the high bit off of ISO-8859-1 text.
|
|