开发者

Replace worldwide diacritics characters [duplicate]

This question already has answers here: 开发者_如何学运维 Closed 11 years ago.

Possible Duplicate:

PHP: Replace umlauts with closest 7-bit ASCII equivalent in an UTF-8 string

I want to replace diacritics characters with his non-diacritics brother. example: from "guľôčka" I wanna get "gulocka"

Is here some native function to do it?

I was looking for list of all worldwide diacritics characters for replace with str_replace. I can't find it.

Thanks a lot.


You can achieve this by using iconv, available in PHP, and requesting an encoding conversion with transliteration. (This actually works for many different scripts!) If you only want basic European characters, make the target Latin-1, or even ASCII.

From the manual page:

iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜