作者easy1 (e :) y)
看板Web_Design
标题Re: [问题] utf-8
时间Tue Mar 29 16:12:37 2005
※ 引述《easy1 (e :) y)》之铭言:
: 我的文件是utf8 encoding
: 而且也如此写了
: <html>
: <head>
: <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
: </head>
: ..
: ..
: </html>
: 但浏览器开的时候还是会判断成iso-8859-1 出现一堆乱码
: 非得要手动去选浏览器编码才可以正常看到文字
: 请问是哪里我疏忽了吗
自问自答
http://www.w3.org/TR/REC-html40/charset.html
决定一个文件显示的编码有三个优先续
1. An HTTP "charset" parameter in a "Content-Type" field.
2. A META declaration with "http-equiv" set to "Content-Type" and a value set for "charset".
3. The charset attribute set on an element that designates an external resource.
1. server端 2. <meta http...> 3. 浏览器控制之类的
我之前的问题忘了说 我是用php的网页
只要在适当地方加上
header(Content-Type: text/html; charset=utf-8);
或是perl
print "Content-Type: text/html; charset=utf-8\n\n";
--
PLUR
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 84.162.90.107
1F:推 backfish:这篇可M 192.192.197.5 03/29