Shahid Karimi
Shahid Karimi

Reputation: 4357

mysql charset latin1 into utf-8 conversion issue

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

Upvotes: 0

Views: 115

Answers (1)

loveNoHate
loveNoHate

Reputation: 1547

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

Upvotes: 1

Related Questions