-
Notifications
You must be signed in to change notification settings - Fork 175
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
evaluateJavaScript 执行结果中有乱码 #376
Comments
执行的是官方提供的HelloWorld.js吗?乱码具体是指哪个地方有乱码?(截图没太看明白) |
HelloWorld.js是自己写的,只有一个test方法,返回一个stringify的json,这个json展示出来有乱码。截图的第三行开头 |
|
这个问题我这好像复现不了,你有其他类似的case出现吗? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
描述
master 分支
Hummer version:
master 分支源码依赖
复现步骤
设备 samsung-G532F,android 系统版本 5.0
1.执行js逻辑
2.结果中出现乱码
预期结果
结果正常
样例代码、屏幕截图或者仓库链接
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_home);
if (context == null) {
context = JSCContext.create();
((TextView) findViewById(R.id.info)).setText("context id is" + context.context);
}
findViewById(R.id.test).setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View view) {
try {
String js = readFileFromAssets(getApplicationContext(), "HelloWorld.js");
context.evaluateJavaScript(js);
} catch (Exception ex) {
Log.e(TAG, ex.getLocalizedMessage());
}
Object res = context.evaluateJavaScript("test()");
Log.i(TAG, "res is " + res);
((TextView) findViewById(R.id.res)).setText("context id is" + context.context + "\n" + res.toString());
}
});
}
helloword.js
function test() {
let data = { "path": "/api/v4/recommend/recommend", "method": "GET", "params": ["bundle=daily_discover_main", "offset=0", "latitude=", "longitude=", "limit=20"] }
return JSON.stringify(data);
}
The text was updated successfully, but these errors were encountered: