Charset=utf8 在我的 PHP 页面中不起作用
我的字符编码有问题.每当我在浏览器中加载页面时,它显示如下:
所以我需要通过浏览器手动配置它.感谢您的帮助.
解决方案听起来您的内容并未以 utf-8 格式提供.通过设置正确的标题来做到这一点:
<块引用>header('Content-type: text/html; charset=utf-8');
除了确保浏览器理解之外,添加一个元标记:
<块引用><meta http-equiv="Content-type" content="text/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.
相关文章