mysql charset latin1 into utf-8 conversion issue

2019-09-07 00:13发布

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

标签: utf-8 latin1
1条回答
forever°为你锁心
2楼-- · 2019-09-07 00:53

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. ;)

查看更多
登录 后发表回答