引用问题 [英]  enconding issue

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

问题描述

我正在开发一个使用PHP的网站,这些奇怪的字符ï¿¿出现在我的页面上,就在它的顶部。
我的代码是这样的:

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

但是,当我在浏览器中看到源代码时,它显示了这一点:

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

我不知道是否与我正在使用的编码有任何关系,因为当我更改charset到 charset = utf-8 它会消失,但我必须使用iso-8859-1

解决方案

这是 BOM字符,这是因为源代码文件是保存为UTF-8 BOM。尝试将它们保存为UTF-8无BOM(或无论您的编辑器称之为)还是将其保存为ISO-8859-1(如果您必须使用它)(...为什么要这样做?)。

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" />

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

解决方案

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天全站免登陆