mysql charset latin1 into utf-8 conversion issue

混江龙づ霸主 提交于 2019-12-25 02:49:18

问题


My client's web app has large database which millions of records. All table's encoding is latin1.

When I fetch some text field which holds huge data and mail that string some strange haracter issue comes. Such when I recieve email spaces are converted into this character Â. It is not premissible to change the DB encoding. I tried the following PHP function but no outcome ;(

$msg = mb_convert_encoding($msg, "UTF-8", "latin1");

Please help


回答1:


I would check for the encoding php thinks it is

echo mb_detect_encoding($str);

And then do

iconv("detectedEncoding", "UTF-8", $str);

Or if iconv is not installed, check if your encoding was right in your solution. ;)



来源:https://stackoverflow.com/questions/21485116/mysql-charset-latin1-into-utf-8-conversion-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!