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

查看:25
本文介绍了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.

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

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