Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

汉字会乱码或显示出错 #21

Closed
xiangding1983 opened this issue Dec 31, 2015 · 5 comments
Closed

汉字会乱码或显示出错 #21

xiangding1983 opened this issue Dec 31, 2015 · 5 comments

Comments

@xiangding1983
Copy link

bridge.callHandler('test',{"content":"乐乐乐乐"}, function(response) {
alert(response);
}

类似这种, 在android里,取到content时,汉字不正确了,

@imliujun
Copy link
Contributor

imliujun commented Jan 4, 2016

js调用Java,在1.0.2版本的没有中文乱码的问题,升级到1.0.3Java这边接收到的中文就变成乱码了。
我看了commit记录增加了base64加密,去掉了URLDecoder,乱码是不是因为这个引发的。
@lzyzsd

@uknownothingsnow
Copy link
Owner

@imliujun 我检查一下,添加base64主要就是为了处理一些中文在某些版本的webview上,使用urlencoder乱码的问题

@uknownothingsnow
Copy link
Owner

@xiangding1983 @imliujun 感谢反馈,暂时回退回使用URLEncode的方式,base64我再找原因,请使用1.0.4

@allenzerg001
Copy link

base64导致中文乱码原因是:虽然Html和JS的编码都是utf-8,但JS从页面上得到的中文编码却是utf-16,所以直接对中文进行Base64编码将得到错误的结果,所以我们要先从utf-16转到utf-8再编码。
参考文档和解决方案详见:http://bbs.blueidea.com/thread-2914615-1-1.html

@uknownothingsnow
Copy link
Owner

@allenzerg001 thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants