作者justinC (无)
看板Web_Design
标题Re: [问题] utf-8
时间Fri Feb 17 22:11:41 2006
※ 引述《Clessin (Clemond)》之铭言:
: ※ 引述《easy1 (e :) y)》之铭言:
: : 自问自答
: : 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";
: 附带提问一下:
: 如果UTF-8的网页要去读取以UTF8为文字编码的资料库的话,是不是还要有其它的步骤
: 要做?因为我用MySQL 4.1版(资料库以utf8编码),select资料出来显示在网页上的中文
: 都是问号(????)。我的网页是utf-8格式储存,在网页的<head> </head>中加了
: <meta http-equiv="Content-Type" content="text/html; charset=utf-8">这一行。
: 也照原作者的方式在PHP中加了header(Content-Type: text/html; charset=utf-8);
: 还缺少那个步骤吗?谢谢!
我跟这位大大情形很像
mysql用utf-8编码
网页也是utf-8 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
可是跑出来一样是big5
我猜是server预设是big5
mysql_query("SET NAMES 'utf-8'");//这句也加了
有什麽办法可以真的改成utf-8吗
header那段我加在php 会变成空白..
不过空白却变utf-8
不过我header放在<html>前应该不用开缓冲区吧
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.221.120.127
※ 编辑: justinC 来自: 61.221.120.127 (02/17 22:22)
※ 编辑: justinC 来自: 61.221.120.127 (02/17 22:28)