Bot-Babelfish

 view release on metacpan or  search on metacpan

lib/Bot/Babelfish.pm  view on Meta::CPAN

           "  where 'from' and 'to' are two-letters codes of source and destination languages\n".
           "  see http://babelfish.altavista.com/ for the list of supported languages.\n".
           "  example:    babel: fr en: ceci n'est pas une pipe"
}

=item non_unicode_version()

This function returns a printable version of the given string 
(with a European value of "printable" C<:-)>. More precisely, 
if the string only contains Latin-1 characters, it is returned 
decoded from internal Perl format. If the string contains 
others characters outside Latin-1, it's converted using 
C<Text::Unidecode>. 

=cut

sub non_unicode_version {
    my $text = shift;
    my $wide = 0;
    ord($_) > 255 and $wide++ for split //, $text;
    return $wide ? unidecode($text) : encode('iso-8859-1', $text)



( run in 0.316 second using v1.01-cache-2.11-cpan-26ccb49234f )