| unidecode_php-0.3.tar.gz |
[Dec. 18th, 2008|11:39 pm] |
I recently wrote a conversion script and PHP wrapper so that the data from the Perl "last-chance transliterator" Text::Unidecode by Sean M. Burke can be used from PHP: unidecode_php-0.3.tar.gz. To use this you'll need to install the Perl Text::Unidecode module and then run the udec2bin.pl script inside the unidecode_php package.
Example PHP usage: <?php
require("unidecode.php");
print htmlspecialchars(unidecode("中文", "utf-8"));
?> produces Zhong Wen
This allows very basic conversion of lots of Unicode to plain ASCII. It works pretty well for some scripts and languages, is somewhat usable for several more, and fails utterly in some. Here are some examples excerpted from the Emacs-MULE HELLO file, along with their ASCII transliterations:
( (long) )
update: version 0.2 adds a couple examples.
update: version 0.3 is better at finding the datafiles when included from another directory. |
|
|