phptransliteration

PHP Transliteration


Are there any solutions that will convert all foreign characters to A-z equivalents? I have searched extensively on Google and could not find a solution or even a list of characters and equivalents. The reason is I want to display A-z only URLs, plus plenty of other trip ups when dealing with these characters.


Solution

  • You can use iconv, which has a special transliteration encoding.

    When the string "//TRANSLIT" is appended to tocode, transliteration is activated. This means that when a character cannot be represented in the target character set, it can be approximated through one or several characters that look similar to the original character.

    -- http://www.gnu.org/software/libiconv/documentation/libiconv/iconv_open.3.html

    See here for a complete example that matches your use case.