mysql charset latin1转换为utf-8的问题 [英] mysql charset latin1 into utf-8 conversion issue

查看:119
本文介绍了mysql charset latin1转换为utf-8的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的客户的Web应用程序具有大型数据库,其中包含数百万条记录.所有表格的编码均为latin1.

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

当我获取一些包含大量数据的文本字段并发送包含字符串的邮件时,会出现一些奇怪的问题.这样,当我收到电子邮件空间时,将转换为该字符. 不允许更改DB编码. 我尝试了以下PHP函数,但没有结果;(

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

请帮助

推荐答案

我会检查php认为是的编码

I would check for the encoding php thinks it is

echo mb_detect_encoding($str);

然后做

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

或者,如果未安装iconv,请检查您的编码是否正确在您的解决方案中. ;)

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

这篇关于mysql charset latin1转换为utf-8的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆