Charset = utf8在我的PHP页面中不工作 [英] Charset=utf8 not working in my PHP page

查看:127
本文介绍了Charset = utf8在我的PHP页面中不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的字元编码有问题。每当我在浏览器中加载页面时,它显示如下:

所以我需要通过浏览器手动配置它。感谢您的帮助。

解决方案

听起来您不会将您的内容作为utf-8。通过设置正确的头:


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


除了确保浏览器能够理解之外, -tag:


 < meta http-equiv =Content-typecontent = / html; charset = utf-8/> 


请注意,根据文本的来源,还需要检查一些其他的东西(数据库连接,源文件编码,...) - 我列出了很多他们在我对类似问题的答案


I got a problem with my character encoding. Whenever I load a page in the browser, It shows like this:

So I need to manually configure it by the browser. Thanks for your help.

解决方案

sounds like you don't serve your content as utf-8. do this by setting the correct header:

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

in addition to be really sure the browser understands, add a meta-tag:

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

note that, depending on where the text comes from, you might have to check some other things too (database-connection, source-file-encoding, ...) - i've listed a lot of them in one of my answers to a similar question.

这篇关于Charset = utf8在我的PHP页面中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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