utf-8特殊字符不显示 [英] utf-8 special characters not displaying

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

问题描述

我把我的网站从我的本地测试服务器移动到NameCheap共享托管,现在我遇到了一个问题 - 有些页面没有正确显示utf-8特殊字符(显示问号)。所有页面都是utf-8编码,以及所有数据库表。奇怪的是,一些页面正确显示,有些页面看起来是随机的。



例如,我的索引页面很好,但是我的个人资料页面是T。 faq.html工作正常,但是当我将其重命名为faq.php时,它不会。最奇怪的是,我有一个带有两个JQuery选项卡的页面,其中一个正确显示,另一个不显示。



有人可以帮我吗? >

解决方案

这是一个非常令人讨厌的问题,但您可以尝试这些。



首先,确保该文件实际上以UTF-8格式保存。



然后检查您是否具有< meta http-equiv =您的HTML标题中的Content-Typecontent =text / html; charset = UTF-8>



尝试在PHP脚本开头调用头('Content-Type:text / html; charset = utf-8'); 或添加 AddDefaultCharset UTF-8 到您的.htaccess文件。


I moved my website from my local test server to NameCheap shared hosting and now I'm running into a problem - some of the pages aren't displaying utf-8 special characters properly (showing question marks instead). All pages are utf-8 encoded, as are all database tables. The strange thing is, some pages display correctly and some don't, in a seemingly random pattern.

For instance, my index page is fine, but my profile page isn't. faq.html works fine, but when I rename it to faq.php it doesn't. And weirdest of all, I have a page with two JQuery tabs where one displays correctly and the other doesn't!

Can someone help me out with this?

解决方案

This is really annoying problem to fix but you can try these.

First of all, make sure the file is actually saved in UTF-8 format.

Then check that you have <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> in your HTML header.

You can also try calling header('Content-Type: text/html; charset=utf-8'); at the beginning of your PHP script or adding AddDefaultCharset UTF-8 to your .htaccess file.

这篇关于utf-8特殊字符不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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