How to prevent showing the diamond question mark symbol, even using mb_substr and utf-8

前端 未结 3 1194
梦毁少年i
梦毁少年i 2021-02-04 17:55

I have read some other questions, tried the answers but got no result at the end. What I get is for example this

Μήπως θα έπρεπε να � ...

and I

3条回答
  •  迷失自我
    2021-02-04 18:23

    I believe the issue is with your encoding. Your outputting UTF-8 but your browser cannot interpret one of the characters. The question mark symbol as I have known it in the past is actually generated by the browser, so there is no search and replace....it's about fixing your encoding OR eliminating unknown characters from the string before outputting it...

    If you have access to the source of data, then you may want to check the DB settings to make sure it's encoded properly...if not, then you'll have to find someway to convert the data over using php...not an easy task...

    Perhaps:

    mb_convert_encoding($string, "UTF-8");
    

提交回复
热议问题