mysql数据库中的php中未显示汉字

mysql数据库中的php中未显示汉字

本文介绍了mysql数据库中的php中未显示汉字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个使用多语言内容的项目

I am working on one project which uses multi-language content

http://school.rssas.org

问题:数据库中不显示汉字

Problem: Chinese characters not displaying in from database

实际上,它在具有相同数据库文件的本地主机上工作.当我将其上载到服务器宪章时,不支持但同时在local上可以正常工作时,我已经尝试了所有与数据库有关的解决方案.

Actually its working on local host with same database files. When i upload it on server charters are not supporting but same time working fine on local , i have tried all solutions related to database.

http://school.rssas.org

推荐答案

尝试一下

header('Content-Type: text/html; charset=utf-8');

有时,还需要解释的是,用户在连接到数据库时正在发送/期待UTF-8编码的数据,因此MySQL认为它应该处理latin1编码的数据并进行相应的转换.连接到数据库后发出命令SET NAMES utf8

Also sometimes what needs to be explained is that the user is sending/expecting UTF-8 encoded data when connecting to the database, so MySQL thinks it's supposed to handle latin1 encoded data and converts it accordingly. Issue the command SET NAMES utf8 after connecting to the db

请让我知道它是否仍然无法正常工作

Please let me know if it still doesn't work

这篇关于mysql数据库中的php中未显示汉字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-20 23:44