android - Encoding not correct with Volley JsonObjectRequest API - UTF-8 -
i have problem between api (nodejs) , android client encoding.
android volley request:
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);
header of request:
content-type → application/json; charset=utf-8
test log:
test: {"announces":[{"_id":"56360bca8c9356a3289788aa","title":"marché", ....
normal title should "marché" it's not working..
where problem ? api or android client ? have used volley lib in different project , works properly...
neither wrong, don't match. client assuming encoding of result utf-8, apparently not.
so, have 2 choices - either force nodejs return utf-8, or figure out encoding returning, , use on android side.
Comments
Post a Comment