mysql的字符集问题 [英] charset issue with mysql

查看:51
本文介绍了mysql的字符集问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将以下行存储在mysql中:

I'm trying to store the following line in mysql:

$data = "After 30μs, what fraction of the charge will remain?"

如果我在HTML页面上显示$ data,我会得到确切的文本,但是如果我将其存储在数据库中,那么我会在输出中得到此数据,则得到以下内容:

If I display $data on HTML Page I get the exact text but if i store this in database then i get this data on output I get the following :

After 30Î?s, what fraction of the charge will remain?

我已经设置了charset = utf-8,但是即使那样我也无法使用所有符号访问正确的数据.有什么我想念的吗????

I have set charset=utf-8 but even then i'm not able to access the proper data with all the symbols. Is there anything I'm missing ????

推荐答案

您需要设置数据库连接编码:

You need to set database connection encoding:

mysql_set_charset('utf8');

或类似的方法,具体取决于您的数据库库.

Or similar method, depending on your database library.

这篇关于mysql的字符集问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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