如何使用纯JavaScript将GBK转换为UTF8? [英] How do I convert GBK to UTF8 with pure Javascript?
问题描述
有没有可以转换这些GBK文本转换成UTF8显示?
由于某些原因,我只能使用Javascript。
http://www.1kjs.com/lib/widget/gbk /
有一个javascript可以在gbk和unicode之间进行转换: 将所有21886 gbk中文字符映射到unicode您可以下载 javascript文件,包含它并使用:
unicode to gbk:
$ URL.encode(unicode_string)
或gbk to unicode:
$ URL.decod e(gbk_string)
我测试了它。在我的网站上工作得很好:zhuhaiyang.sinaapp.com/base64/index.html
使用纯javascript做base64。。。
I want to load some text from other site wich the content is GBK encoded, but my site is UTF8.
Is there anyway by which I can convert these GBK text into UTF8 for display ?
For some reasons I can only use Javascript for this.
http://www.1kjs.com/lib/widget/gbk/
There is a javascript to convert between gbk and unicode: which maps all the 21886 gbk Chinese chars to unicode
You can simply download the javascript file , include it and using :
unicode to gbk:
$URL.encode(unicode_string)
or gbk to unicode:
$URL.decode(gbk_string)
I tested it. It's working well on my web : zhuhaiyang.sinaapp.com/base64/index.html
which do base64 ency using pure javascript.
这篇关于如何使用纯JavaScript将GBK转换为UTF8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!