字符编码问题? [英] Character Encoding problem?

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

问题描述

在我的mysql数据库中,我在一个页面名称字段中有以下信息。

In my mysql database I have the following information in a page name field.


ç,Ç,ö,Ö,

ç,Ç,ö,Ö,ü,Ü,ı,İ,ş,Ş,ğ,Ğ

如果我做了一个phpmyadmin转储,上面的输出。

If I do a phpmyadmin dump the above is exported.

我使用的是不同的php脚本,而不是上面的代码。

I am using a different php script and instead of the above I am getting this.


à,Ç,Ã,,¬,ü,Ã,ı,Ä°,ÅŸ,Åž,ÄŸ,Äž

"ç,Ç,ö,Ö,ü,Ü,ı,İ,ş,Ş,ğ,Ğ"

这是生成输出的代码段。

This is the snippet which is generating the output.

$data_sql = "SELECT * FROM ".$table_name;
$data_res = @mysql_query($data_sql);


while($data_row = @mysql_fetch_array($data_res,MYSQL_NUM))
{
 print_r($data_row);
}

如何修改此设置以确保数据正确?是否需要某种类型的php功能?我需要对文件执行某些操作吗?

How can I modify this to make sure that the data is correct? Is some sort of php function required? Do I need to do something to the file?

任何建议都非常感谢。

推荐答案

您可以通过这种方式设置客户端编码:

You can set client encoding this way:

mysql_connect();
mysql_select_db("database");
mysql_query("SET CHARACTER SET utf8");

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

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