Detect encoding and make everything UTF-8

前端 未结 24 2367
暗喜
暗喜 2020-11-22 03:03

I\'m reading out lots of texts from various RSS feeds and inserting them into my database.

Of course, there are several different character encodings used in the fee

24条回答
  •  旧巷少年郎
    2020-11-22 03:06

    @harpax that worked for me. In my case, this is good enough:

    if (isUTF8($str)) { 
        echo $str; 
    }
    else
    {
        echo iconv("ISO-8859-1", "UTF-8//TRANSLIT", $str);
    }
    

提交回复
热议问题