Mysql-Html字符串问题

发布于 2024-11-27 11:39:32 字数 688 浏览 0 评论 0原文

我有一张表,在 joomla 中我得到以下数据: 在此处输入图像描述

1. fc k��ln - vfl wolfsburg
germany 1. bundesliga 

所以我创建了一个测试页面,我将标头设置为 utf-8,一切都很好,我收到了想要的数据:

Array
(
    [0] => Array
        (
            [id] => 4e36e64eb34d2
            [team1] => 1. FC Köln
            [team2] => VFL Wolfsburg
            [league] => Germany 1. Bundesliga
            [sport] => Soccer
            [time] => 2011-08-06 15:30:00
        )

)

我还检查了 joomla 标头,它包含字符集:

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

我做错了什么?

I have a table, in joomla I'm getting the following data:
enter image description here

1. fc k��ln - vfl wolfsburg
germany 1. bundesliga 

so I created a test page, I set up the header as utf-8, and everything was fine, I received the wanted data:

Array
(
    [0] => Array
        (
            [id] => 4e36e64eb34d2
            [team1] => 1. FC Köln
            [team2] => VFL Wolfsburg
            [league] => Germany 1. Bundesliga
            [sport] => Soccer
            [time] => 2011-08-06 15:30:00
        )

)

I also check the joomla header and it's contains the charset:

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

西瑶 2024-12-04 11:39:32

你的数据库连接必须设置为UTF8

在includes/database.php文件中大约第102行(下面第二行)处设置mysql连接字符集

$this->_table_prefix = $table_prefix; 
//@mysql_query("SET NAMES 'utf8'", $this->_resource); // THIS IS THE LINE TO UNCOMMENT 
$this->_ticker = 0; 
$this->_og = array();

当然你表中的数据必须是utf-8,检查这一点。

其他可能要检查的事情是您的浏览器是否将此页面视为 utf8(在 firefox 中:查看 -> 字符编码)

your database connection has to be set UTF8

set the mysql connection charset in includes/database.php file at about line 102 (second line below)

$this->_table_prefix = $table_prefix; 
//@mysql_query("SET NAMES 'utf8'", $this->_resource); // THIS IS THE LINE TO UNCOMMENT 
$this->_ticker = 0; 
$this->_og = array();

Ofcourse your data in table has to be utf-8, check this.

Other possibible thing to check is if your browser sees this page as utf8 (in firefox: View->character encoding)

小情绪 2024-12-04 11:39:32

也许您的文件编码错误?当我的文件采用 CP-1251 格式时,我遇到了类似的问题,所有数据均采用 UTF-8 格式,并且我需要显示丹麦符号。更改文件编码已经解决了这个问题。尝试一下,也许对你也有帮助。

Maybe your files are in wrong encoding? I was having similar problem whan my files were in CP-1251, all data were in UTF-8 and I needed to show danish symbols. Changing file-encoding has solved this problem. Try, maybe it will be helpfull for you too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文