android - Response with non-Latin letters using Volley (UTF-8) -
i'm using volley download text files website.
this content of sample text file:
neon wönn 30€ kostüm größter spaß testtesttesttest★★★★testtest:::test
i put in notepad , selected 'encoding utf-8' in savefiledialog. in filezilla in server manager selected 'force utf-8' before uploaded file.
when download volley response this:
neon wönn 30⬠kostüm gröÃter spaà testtesttesttestââââtesttest:::test
here method:
public static void getrequest(string url) { requestqueue queue = volley.newrequestqueue(activity); stringrequest stringrequest = new stringrequest(request.method.get, url, new response.listener<string>() { @override public void onresponse(string response) { //response gibberish :/ } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { log.e("volleyerror", error.tostring()); } }); stringrequest.setshouldcache(false); // add request requestqueue. queue.add(stringrequest); }
is there way fix forcing volley use utf-8 encoding?
i had override method:
@override protected response<string> parsenetworkresponse( networkresponse response) { string strutf8 = null; try { strutf8 = new string(response.data, "utf-8"); } catch (unsupportedencodingexception e) { e.printstacktrace(); } return response.success(strutf8, httpheaderparser.parsecacheheaders(response)); }
Comments
Post a Comment