问题
I am using php and I was wondering if there was a predefined way to convert foreign characters to their non-foreign alternatives.
Characters such as ê, ë, é all resulting to 'e'.
I'm looking for a function that would take a string and return it without the special characters.
Any ideas would be greatly appreciated!
回答1:
After failing to find suitable convertors I created my own collection that suits my needs including my favorite Cyrillic conversion that by default has numerous variations.
function transliterateString($txt) {
$transliterationTable = array('á' => 'a', 'Á' => 'A', 'à' => 'a', 'À' => 'A', 'ă' => 'a', 'Ă' => 'A', 'â' => 'a', 'Â' => 'A', 'å' => 'a', 'Å' => 'A', 'ã' => 'a', 'Ã' => 'A', 'ą' => 'a', 'Ą' => 'A', 'ā' => 'a', 'Ā' => 'A', 'ä' => 'ae', 'Ä' => 'AE', 'æ' => 'ae', 'Æ' => 'AE', 'ḃ' => 'b', 'Ḃ' => 'B', 'ć' => 'c', 'Ć' => 'C', 'ĉ' => 'c', 'Ĉ' => 'C', 'č' => 'c', 'Č' => 'C', 'ċ' => 'c', 'Ċ' => 'C', 'ç' => 'c', 'Ç' => 'C', 'ď' => 'd', 'Ď' => 'D', 'ḋ' => 'd', 'Ḋ' => 'D', 'đ' => 'd', 'Đ' => 'D', 'ð' => 'dh', 'Ð' => 'Dh', 'é' => 'e', 'É' => 'E', 'è' => 'e', 'È' => 'E', 'ĕ' => 'e', 'Ĕ' => 'E', 'ê' => 'e', 'Ê' => 'E', 'ě' => 'e', 'Ě' => 'E', 'ë' => 'e', 'Ë' => 'E', 'ė' => 'e', 'Ė' => 'E', 'ę' => 'e', 'Ę' => 'E', 'ē' => 'e', 'Ē' => 'E', 'ḟ' => 'f', 'Ḟ' => 'F', 'ƒ' => 'f', 'Ƒ' => 'F', 'ğ' => 'g', 'Ğ' => 'G', 'ĝ' => 'g', 'Ĝ' => 'G', 'ġ' => 'g', 'Ġ' => 'G', 'ģ' => 'g', 'Ģ' => 'G', 'ĥ' => 'h', 'Ĥ' => 'H', 'ħ' => 'h', 'Ħ' => 'H', 'í' => 'i', 'Í' => 'I', 'ì' => 'i', 'Ì' => 'I', 'î' => 'i', 'Î' => 'I', 'ï' => 'i', 'Ï' => 'I', 'ĩ' => 'i', 'Ĩ' => 'I', 'į' => 'i', 'Į' => 'I', 'ī' => 'i', 'Ī' => 'I', 'ĵ' => 'j', 'Ĵ' => 'J', 'ķ' => 'k', 'Ķ' => 'K', 'ĺ' => 'l', 'Ĺ' => 'L', 'ľ' => 'l', 'Ľ' => 'L', 'ļ' => 'l', 'Ļ' => 'L', 'ł' => 'l', 'Ł' => 'L', 'ṁ' => 'm', 'Ṁ' => 'M', 'ń' => 'n', 'Ń' => 'N', 'ň' => 'n', 'Ň' => 'N', 'ñ' => 'n', 'Ñ' => 'N', 'ņ' => 'n', 'Ņ' => 'N', 'ó' => 'o', 'Ó' => 'O', 'ò' => 'o', 'Ò' => 'O', 'ô' => 'o', 'Ô' => 'O', 'ő' => 'o', 'Ő' => 'O', 'õ' => 'o', 'Õ' => 'O', 'ø' => 'oe', 'Ø' => 'OE', 'ō' => 'o', 'Ō' => 'O', 'ơ' => 'o', 'Ơ' => 'O', 'ö' => 'oe', 'Ö' => 'OE', 'ṗ' => 'p', 'Ṗ' => 'P', 'ŕ' => 'r', 'Ŕ' => 'R', 'ř' => 'r', 'Ř' => 'R', 'ŗ' => 'r', 'Ŗ' => 'R', 'ś' => 's', 'Ś' => 'S', 'ŝ' => 's', 'Ŝ' => 'S', 'š' => 's', 'Š' => 'S', 'ṡ' => 's', 'Ṡ' => 'S', 'ş' => 's', 'Ş' => 'S', 'ș' => 's', 'Ș' => 'S', 'ß' => 'SS', 'ť' => 't', 'Ť' => 'T', 'ṫ' => 't', 'Ṫ' => 'T', 'ţ' => 't', 'Ţ' => 'T', 'ț' => 't', 'Ț' => 'T', 'ŧ' => 't', 'Ŧ' => 'T', 'ú' => 'u', 'Ú' => 'U', 'ù' => 'u', 'Ù' => 'U', 'ŭ' => 'u', 'Ŭ' => 'U', 'û' => 'u', 'Û' => 'U', 'ů' => 'u', 'Ů' => 'U', 'ű' => 'u', 'Ű' => 'U', 'ũ' => 'u', 'Ũ' => 'U', 'ų' => 'u', 'Ų' => 'U', 'ū' => 'u', 'Ū' => 'U', 'ư' => 'u', 'Ư' => 'U', 'ü' => 'ue', 'Ü' => 'UE', 'ẃ' => 'w', 'Ẃ' => 'W', 'ẁ' => 'w', 'Ẁ' => 'W', 'ŵ' => 'w', 'Ŵ' => 'W', 'ẅ' => 'w', 'Ẅ' => 'W', 'ý' => 'y', 'Ý' => 'Y', 'ỳ' => 'y', 'Ỳ' => 'Y', 'ŷ' => 'y', 'Ŷ' => 'Y', 'ÿ' => 'y', 'Ÿ' => 'Y', 'ź' => 'z', 'Ź' => 'Z', 'ž' => 'z', 'Ž' => 'Z', 'ż' => 'z', 'Ż' => 'Z', 'þ' => 'th', 'Þ' => 'Th', 'µ' => 'u', 'а' => 'a', 'А' => 'a', 'б' => 'b', 'Б' => 'b', 'в' => 'v', 'В' => 'v', 'г' => 'g', 'Г' => 'g', 'д' => 'd', 'Д' => 'd', 'е' => 'e', 'Е' => 'E', 'ё' => 'e', 'Ё' => 'E', 'ж' => 'zh', 'Ж' => 'zh', 'з' => 'z', 'З' => 'z', 'и' => 'i', 'И' => 'i', 'й' => 'j', 'Й' => 'j', 'к' => 'k', 'К' => 'k', 'л' => 'l', 'Л' => 'l', 'м' => 'm', 'М' => 'm', 'н' => 'n', 'Н' => 'n', 'о' => 'o', 'О' => 'o', 'п' => 'p', 'П' => 'p', 'р' => 'r', 'Р' => 'r', 'с' => 's', 'С' => 's', 'т' => 't', 'Т' => 't', 'у' => 'u', 'У' => 'u', 'ф' => 'f', 'Ф' => 'f', 'х' => 'h', 'Х' => 'h', 'ц' => 'c', 'Ц' => 'c', 'ч' => 'ch', 'Ч' => 'ch', 'ш' => 'sh', 'Ш' => 'sh', 'щ' => 'sch', 'Щ' => 'sch', 'ъ' => '', 'Ъ' => '', 'ы' => 'y', 'Ы' => 'y', 'ь' => '', 'Ь' => '', 'э' => 'e', 'Э' => 'e', 'ю' => 'ju', 'Ю' => 'ju', 'я' => 'ja', 'Я' => 'ja');
return str_replace(array_keys($transliterationTable), array_values($transliterationTable), $txt);
}
回答2:
I coded this function which uses the HTML entities translation table built-in into PHP to romanize chars:
function Unaccent($string)
{
if (strpos($string = htmlentities($string, ENT_QUOTES, 'UTF-8'), '&') !== false)
{
$string = html_entity_decode(preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|tilde|uml);~i', '$1', $string), ENT_QUOTES, 'UTF-8');
}
return $string;
}
It works by applying htmlentities()
and then removing common entities suffixes, a simple example:
- ã = ã -> a
- Ã = Ã -> A
- õ = õ -> o
- Õ = Õ -> O
- æ = æ -> ae
- Æ = Æ -> AE
Beware that for this to work properly your files need to be encoded in UTF-8 (no BOM obviously).
See also my other answer for another example.
回答3:
My first recommendation is the iconv function. Namely because it's built into PHP, so doesn't require any external or 3rd party libraries. In addition, it's a function that's designed to do precisely what you are trying to accomplish (accept on character set as input, and output an alternate character set, specifically going from UTF-8 to ASCII). Below is an example of how to call this function:
$clean_ascii_output = iconv('UTF-8', 'ASCII//TRANSLIT', $utf8_input);
More information about the specifics of this PHP function can be found here: http://php.net/manual/en/function.iconv.php
Note: The iconv function accepts string inputs, so you'll want to iterate over data, and parse it such that you are passing in a string input.
回答4:
Try iconv()
http://www.php.net/manual/en/function.iconv.php with the //TRANSLIT
option, or
recode_string()
http://www.php.net/manual/en/function.recode-string.php, or
mb_convert_encoding()
http://www.php.net/manual/en/function.mb-convert-encoding.php
回答5:
I hope this will be useful for anybody: https://github.com/infralabs/DiacriticsRemovePHP
This class removes diacritics from strings containing Latin-1 Supplement, Latin Extended-A and Latin Extended-B special characters.
usage:
$specialCharacters = "";
$specialCharacters .= "Latin-1 Supplement".PHP_EOL;
$specialCharacters .= "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ".PHP_EOL;
$specialCharacters .= "Latin Extended-A".PHP_EOL;
$specialCharacters .= "ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ".PHP_EOL;
$specialCharacters .= "Latin Extended-B".PHP_EOL;
$specialCharacters .= "ƒǺǻǼǽǾǿ".PHP_EOL;
$specialCharacters .= "Latin Extended Additional".PHP_EOL;
$specialCharacters .= "ẀẁẂẃẄẅỲỳ".PHP_EOL;
print "<pre>";
print removeDiacritics($specialCharacters).PHP_EOL;
print "</pre>";
source:
Latin-1 Supplement
ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
Latin Extended-A
ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ
Latin Extended-B
ƒǺǻǼǽǾǿ
Latin Extended Additional
ẀẁẂẃẄẅỲỳ
result:
Latin-1 Supplement
AAAAAAAECEEEEIIIIDNOOOOO×OUUUUYTHssaaaaaaaeceeeeiiiidnooooo÷ouuuuythy
Latin Extended-A
AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIJijJjKkĸLlLlLlLlLlNnNnNnnNnOoOoOoOEoeRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZzs
Latin Extended-B
fAaAEaeOo
Latin Extended Additional
WwWwWwYy
回答6:
The most generic way to solve this is to use Unicode Normalization as it works automatically on all accents - you don't have to prepare the list up front. I don't know if it's easily available in PHP, I have used it in C and Java. Essentially, you first transform the string so that all accented characters are represented by regular character plus so-called composing diacritical mark (a built-in or external library should provide this function), and then remove the composing diacritics (using a specialized library, using character properties the language provides or using some regular expression extensions).
回答7:
Saw this old question and still don't know what the best answer is. In case it can help others, here is a array I made up automatically from
http://www.fileformat.info/info/charset/UTF-8/list.htm
array ("À" => "A",
"Á" => "A",
"Â" => "A",
"Ã" => "A",
"Ä" => "A",
"Å" => "A",
"Æ" => "AE",
"Ç" => "C",
"È" => "E",
"É" => "E",
"Ê" => "E",
"Ë" => "E",
"Ì" => "I",
"Í" => "I",
"Î" => "I",
"Ï" => "I",
"Ð" => "ETH",
"Ñ" => "N",
"Ò" => "O",
"Ó" => "O",
"Ô" => "O",
"Õ" => "O",
"Ö" => "O",
"Ø" => "O",
"Ù" => "U",
"Ú" => "U",
"Û" => "U",
"Ü" => "U",
"Ý" => "Y",
"Þ" => "THORN",
"ß" => "s",
"à" => "a",
"á" => "a",
"â" => "a",
"ã" => "a",
"ä" => "a",
"å" => "a",
"æ" => "ae",
"ç" => "c",
"è" => "e",
"é" => "e",
"ê" => "e",
"ë" => "e",
"ì" => "i",
"í" => "i",
"î" => "i",
"ï" => "i",
"ð" => "eth",
"ñ" => "n",
"ò" => "o",
"ó" => "o",
"ô" => "o",
"õ" => "o",
"ö" => "o",
"ø" => "o",
"ù" => "u",
"ú" => "u",
"û" => "u",
"ü" => "u",
"ý" => "y",
"þ" => "thorn",
"ÿ" => "y",
"Ā" => "A",
"ā" => "a",
"Ă" => "A",
"ă" => "a",
"Ą" => "A",
"ą" => "a",
"Ć" => "C",
"ć" => "c",
"Ĉ" => "C",
"ĉ" => "c",
"Ċ" => "C",
"ċ" => "c",
"Č" => "C",
"č" => "c",
"Ď" => "D",
"ď" => "d",
"Đ" => "D",
"đ" => "d",
"Ē" => "E",
"ē" => "e",
"Ĕ" => "E",
"ĕ" => "e",
"Ė" => "E",
"ė" => "e",
"Ę" => "E",
"ę" => "e",
"Ě" => "E",
"ě" => "e",
"Ĝ" => "G",
"ĝ" => "g",
"Ğ" => "G",
"ğ" => "g",
"Ġ" => "G",
"ġ" => "g",
"Ģ" => "G",
"ģ" => "g",
"Ĥ" => "H",
"ĥ" => "h",
"Ħ" => "H",
"ħ" => "h",
"Ĩ" => "I",
"ĩ" => "i",
"Ī" => "I",
"ī" => "i",
"Ĭ" => "I",
"ĭ" => "i",
"Į" => "I",
"į" => "i",
"İ" => "I",
"ı" => "i",
"Ĵ" => "J",
"ĵ" => "j",
"Ķ" => "K",
"ķ" => "k",
"ĸ" => "kra",
"Ĺ" => "L",
"ĺ" => "l",
"Ļ" => "L",
"ļ" => "l",
"Ľ" => "L",
"ľ" => "l",
"Ŀ" => "L",
"ŀ" => "l",
"Ł" => "L",
"ł" => "l",
"Ń" => "N",
"ń" => "n",
"Ņ" => "N",
"ņ" => "n",
"Ň" => "N",
"ň" => "n",
"ʼn" => "n",
"Ŋ" => "ENG",
"ŋ" => "eng",
"Ō" => "O",
"ō" => "o",
"Ŏ" => "O",
"ŏ" => "o",
"Ő" => "O",
"ő" => "o",
"Ŕ" => "R",
"ŕ" => "r",
"Ŗ" => "R",
"ŗ" => "r",
"Ř" => "R",
"ř" => "r",
"Ś" => "S",
"ś" => "s",
"Ŝ" => "S",
"ŝ" => "s",
"Ş" => "S",
"ş" => "s",
"Š" => "S",
"š" => "s",
"Ţ" => "T",
"ţ" => "t",
"Ť" => "T",
"ť" => "t",
"Ŧ" => "T",
"ŧ" => "t",
"Ũ" => "U",
"ũ" => "u",
"Ū" => "U",
"ū" => "u",
"Ŭ" => "U",
"ŭ" => "u",
"Ů" => "U",
"ů" => "u",
"Ű" => "U",
"ű" => "u",
"Ų" => "U",
"ų" => "u",
"Ŵ" => "W",
"ŵ" => "w",
"Ŷ" => "Y",
"ŷ" => "y",
"Ÿ" => "Y",
"Ź" => "Z",
"ź" => "z",
"Ż" => "Z",
"ż" => "z",
"Ž" => "Z",
"ž" => "z",
"ſ" => "s",
"ƀ" => "b",
"Ɓ" => "B",
"Ƃ" => "B",
"ƃ" => "b",
"Ƅ" => "SIX",
"ƅ" => "six",
"Ɔ" => "O",
"Ƈ" => "C",
"ƈ" => "c",
"Ɖ" => "D",
"Ɗ" => "D",
"Ƌ" => "D",
"ƌ" => "d",
"ƍ" => "delta",
"Ǝ" => "E",
"Ə" => "SCHWA",
"Ɛ" => "E",
"Ƒ" => "F",
"ƒ" => "f",
"Ɠ" => "G",
"Ɣ" => "GAMMA",
"ƕ" => "hv",
"Ɩ" => "IOTA",
"Ɨ" => "I",
"Ƙ" => "K",
"ƙ" => "k",
"ƚ" => "l",
"ƛ" => "lambda",
"Ɯ" => "M",
"Ɲ" => "N",
"ƞ" => "n",
"Ɵ" => "O",
"Ơ" => "O",
"ơ" => "o",
"Ƣ" => "OI",
"ƣ" => "oi",
"Ƥ" => "P",
"ƥ" => "p",
"Ƨ" => "TWO",
"ƨ" => "two",
"Ʃ" => "ESH",
"ƫ" => "t",
"Ƭ" => "T",
"ƭ" => "t",
"Ʈ" => "T",
"Ư" => "U",
"ư" => "u",
"Ʊ" => "UPSILON",
"Ʋ" => "V",
"Ƴ" => "Y",
"ƴ" => "y",
"Ƶ" => "Z",
"ƶ" => "z",
"Ʒ" => "EZH",
"Ƹ" => "EZH",
"ƹ" => "ezh",
"ƺ" => "ezh",
"Ƽ" => "FIVE",
"ƽ" => "five",
"DŽ" => "DZ",
"Dž" => "D",
"dž" => "dz",
"LJ" => "LJ",
"Lj" => "L",
"lj" => "lj",
"NJ" => "NJ",
"Nj" => "N",
"nj" => "nj",
"Ǎ" => "A",
"ǎ" => "a",
"Ǐ" => "I",
"ǐ" => "i",
"Ǒ" => "O",
"ǒ" => "o",
"Ǔ" => "U",
"ǔ" => "u",
"Ǖ" => "U",
"ǖ" => "u",
"Ǘ" => "U",
"ǘ" => "u",
"Ǚ" => "U",
"ǚ" => "u",
"Ǜ" => "U",
"ǜ" => "u",
"ǝ" => "e",
"Ǟ" => "A",
"ǟ" => "a",
"Ǡ" => "A",
"ǡ" => "a",
"Ǣ" => "AE",
"ǣ" => "ae",
"Ǥ" => "G",
"ǥ" => "g",
"Ǧ" => "G",
"ǧ" => "g",
"Ǩ" => "K",
"ǩ" => "k",
"Ǫ" => "O",
"ǫ" => "o",
"Ǭ" => "O",
"ǭ" => "o",
"Ǯ" => "EZH",
"ǯ" => "ezh",
"ǰ" => "j",
"DZ" => "DZ",
"Dz" => "D",
"dz" => "dz",
"Ǵ" => "G",
"ǵ" => "g",
"Ƕ" => "HWAIR",
"Ƿ" => "WYNN",
"Ǹ" => "N",
"ǹ" => "n",
"Ǻ" => "A",
"ǻ" => "a",
"Ǽ" => "AE",
"ǽ" => "ae",
"Ǿ" => "O",
"ǿ" => "o",
"Ȁ" => "A",
"ȁ" => "a",
"Ȃ" => "A",
"ȃ" => "a",
"Ȅ" => "E",
"ȅ" => "e",
"Ȇ" => "E",
"ȇ" => "e",
"Ȉ" => "I",
"ȉ" => "i",
"Ȋ" => "I",
"ȋ" => "i",
"Ȍ" => "O",
"ȍ" => "o",
"Ȏ" => "O",
"ȏ" => "o",
"Ȑ" => "R",
"ȑ" => "r",
"Ȓ" => "R",
"ȓ" => "r",
"Ȕ" => "U",
"ȕ" => "u",
"Ȗ" => "U",
"ȗ" => "u",
"Ș" => "S",
"ș" => "s",
"Ț" => "T",
"ț" => "t",
"Ȝ" => "YOGH",
"ȝ" => "yogh",
"Ȟ" => "H",
"ȟ" => "h",
"Ƞ" => "N",
"ȡ" => "d",
"Ȣ" => "OU",
"ȣ" => "ou",
"Ȥ" => "Z",
"ȥ" => "z",
"Ȧ" => "A",
"ȧ" => "a",
"Ȩ" => "E",
"ȩ" => "e",
"Ȫ" => "O",
"ȫ" => "o",
"Ȭ" => "O",
"ȭ" => "o",
"Ȯ" => "O",
"ȯ" => "o",
"Ȱ" => "O",
"ȱ" => "o",
"Ȳ" => "Y",
"ȳ" => "y",
"ȴ" => "l",
"ȵ" => "n",
"ȶ" => "t",
"ȷ" => "j",
"ȸ" => "db",
"ȹ" => "qp",
"Ⱥ" => "A",
"Ȼ" => "C",
"ȼ" => "c",
"Ƚ" => "L",
"Ⱦ" => "T",
"ȿ" => "s",
"ɀ" => "z",
"Ɂ" => "STOP",
"ɂ" => "stop",
"Ƀ" => "B",
"Ʉ" => "U",
"Ʌ" => "V",
"Ɇ" => "E",
"ɇ" => "e",
"Ɉ" => "J",
"ɉ" => "j",
"Ɋ" => "Q",
"ɋ" => "q",
"Ɍ" => "R",
"ɍ" => "r",
"Ɏ" => "Y",
"ɏ" => "y",
"ɐ" => "a",
"ɑ" => "alpha",
"ɒ" => "alpha",
"ɓ" => "b",
"ɔ" => "o",
"ɕ" => "c",
"ɖ" => "d",
"ɗ" => "d",
"ɘ" => "e",
"ə" => "schwa",
"ɚ" => "schwa",
"ɛ" => "e",
"ɜ" => "e",
"ɝ" => "e",
"ɞ" => "e",
"ɟ" => "j",
"ɠ" => "g",
"ɡ" => "script",
"ɣ" => "gamma",
"ɤ" => "rams",
"ɥ" => "h",
"ɦ" => "h",
"ɧ" => "heng",
"ɨ" => "i",
"ɩ" => "iota",
"ɫ" => "l",
"ɬ" => "l",
"ɭ" => "l",
"ɮ" => "lezh",
"ɯ" => "m",
"ɰ" => "m",
"ɱ" => "m",
"ɲ" => "n",
"ɳ" => "n",
"ɵ" => "barred",
"ɷ" => "omega",
"ɸ" => "phi",
"ɹ" => "r",
"ɺ" => "r",
"ɻ" => "r",
"ɼ" => "r",
"ɽ" => "r",
"ɾ" => "r",
"ɿ" => "r",
"ʂ" => "s",
"ʃ" => "esh",
"ʄ" => "j",
"ʅ" => "squat",
"ʆ" => "esh",
"ʇ" => "t",
"ʈ" => "t",
"ʉ" => "u",
"ʊ" => "upsilon",
"ʋ" => "v",
"ʌ" => "v",
"ʍ" => "w",
"ʎ" => "y",
"ʐ" => "z",
"ʑ" => "z",
"ʒ" => "ezh",
"ʓ" => "ezh",
"ʚ" => "e",
"ʞ" => "k",
"ʠ" => "q",
"ʣ" => "dz",
"ʤ" => "dezh",
"ʥ" => "dz",
"ʦ" => "ts",
"ʧ" => "tesh",
"ʨ" => "tc",
"ʩ" => "feng",
"ʪ" => "ls",
"ʫ" => "lz",
"ʮ" => "h",
"ʯ" => "h")
来源:https://stackoverflow.com/questions/6837148/change-foreign-characters-to-their-roman-equivalent