How to convert special characters to normal characters?

后端 未结 3 1470
难免孤独
难免孤独 2020-12-06 13:03

I am trying to convert characters like:

ë, ä, ï, ö, etc.

To normal characters like:

e, a, i, o, etc.

What

相关标签:
3条回答
  • 2020-12-06 13:30

    try this .. works for me.

    iconv('utf-8', 'ascii//TRANSLIT', $text);
    
    0 讨论(0)
  • 2020-12-06 13:44

    For example, it is create a simple readable URL from a content title:

    function cleanurl($title) {
            return urlencode(strtolower(str_replace(" ","-",preg_replace("/&([a-z])[a-z]+;/i", "$1", htmlentities($title)))));
    }
    
    0 讨论(0)
  • 2020-12-06 13:47

    i like stewies' answer, but for completeness this works for me.

    preg_replace("/&([a-z])[a-z]+;/i", "$1", htmlentities($foo));
    
    0 讨论(0)
提交回复
热议问题