作者benn0106 (...)
看板Ajax
标题Re: [问题] javascript显示中文?
时间Fri Dec 7 20:39:59 2007
※ 引述《TonyQ (骨头)》之铭言:
: ※ 引述《benn0106 (...)》之铭言:
: : 我自己打了一段javascript,如下
: : function A(){
: : document.write("<p>中文</p>");
: : }
: : 结果要存档时丢了一个错误给我
: : "some characters cannot be mapped using ISO-8859-1 character encoding.
: : Either change the encoding or remove the characters which are no supported by
: : the ISO-8859-1 character encoding."
: : 原因我在猜是不是我把引用这个function A()的HTML档案上面,加了
: : <meta
: : http-equiv="Content-Script-Type" content="text/javascript; charset=big5" />
: : 这一行
: : 因为之前HTML一直无法显示中文,我才把charset设定为big5的!
: : ps.我是用Eclipse编辑javascript~
: 这个问题跟你用的编辑器比较有关系。
: 你"档案的格式编码" (不是META的那个charset 而是档案的储存格式)
: 是iso-8859-1 但是你的内容是有不相容的字元
: 检查一下project语系编码的设定吧
自己找了一下答案
我把<meta>找成
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
另外把编辑器的编码设定改成MS950,一切就搞定!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.121.128.76