【发布时间】:2016-02-01 12:36:21
【问题描述】:
我的 API (nodejs) 和我的 android 客户端之间存在关于编码的问题。
Android Volley 请求:
JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.GET, tmpUrl, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.e("TEST", "" + response.toString());
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
}
}
);
queue.add(jsObjRequest);
我的 GET 请求的标头:
content-type → application/json; charset=utf-8
测试日志:
TEST: {"announces":[{"_id":"56360bca8c9356a3289788aa","title":"marché", ....
正常标题应该是“marché”,但它不起作用..
问题出在哪里? API 还是 Android 客户端?我在不同的项目中使用过这个 volley lib,一切正常......
【问题讨论】:
标签: android json encoding utf-8 android-volley