strx:㝤 strx.charCodeAt(0):14180 "".charCodeAt(0):-1.#IND escape(strx):%u3764 encodeURI(strx):%E3%9D%A4 escape(""): String.fromCharCode(20013):中
文件为utf-8格式: codepage=65001: Response.Charset = "gb2312"; strx = chr(54992) strx:涓 strx.charCodeAt(0):20013 "涓?.charCodeAt(0):20013 escape(strx):%u4E2D encodeURI(strx):%E4%B8%AD escape("涓?):%u4E2D String.fromCharCode(20013):涓
Response.Charset = "utf-8"; strx = chr(54992) strx:中 strx.charCodeAt(0):20013 "中".charCodeAt(0):20013 escape(strx):%u4E2D encodeURI(strx):%E4%B8%AD escape("中"):%u4E2D String.fromCharCode(20013):中
codepage=936: Active Server Pages 错误 'ASP 0245' 代码页值的混合使用 /referer_alapha/test2.asp,行 1 指定的 @CODEPAGE 值与包括文件的 CODEPAGE 或文件的保存格式的值不一致。
哈哈,是不是看晕了?我也晕,搞不明白为什么文件存储的格式跟chr(54992)这个函数怎么会扯上关系,而String.fromCharCode(20013)可以得到正确结果(测试的第四部分数据)。大概是Vbs里面逻辑太混乱了。 不管怎样,有了这个方法,gb2312转utf-8简单多了。
(出处:清风网络学院)
上一篇:javascript gb2312转utf-8
下一篇:QQ2006 Beta3的好用新功能:在线收付
|