编码问题 [英]  encoding issue

查看:74
本文介绍了编码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PHP开发一个网站,这些奇怪的字符"出现在我的页面的顶部. 我的代码是这样:

I'm developing a website using PHP and these strange chars "" appears in my page, right on the top of it. My code is this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><?php echo '';?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

但是当我在浏览器中看到源代码时,它显示如下:

But when I see the source code in the browser, it shows this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

我不知道我使用的编码是否与之相关,因为当我将字符集更改为charset=utf-8时,它消失了,但是我必须使用iso-8859-1

I don't know if has any relation to the encoding I'm using, because when I change the charset to charset=utf-8 it disappears but I must use iso-8859-1

推荐答案

这是 BOM字符 ,因为源代码文件保存为UTF-8 BOM.如果必须使用它们,请尝试将它们另存为UTF-8 no-BOM(或您的编辑器所称的名称)或确实是ISO-8859-1(...为什么要保存).

That's a BOM character, which is there because the source code files are saved as UTF-8 BOM. Try to save them as UTF-8 no-BOM (or whatever your editor calls it) or indeed ISO-8859-1 if you must use it (...why would you?).

这篇关于编码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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