Linked Questions

Popular Questions

Unable to parse Gujarati text in JSON

Asked by At

I have developed a web service which is running on JBOSS-EAP. I have a JSON which include Gujarati language which I am unable to parse.

While parsing Gujarati fonts question marks come in the output. I have searched and found I have to change the encoding to UTF-8 and then it will work. I don't know whether it is a correct solution, but regardless of that I have tried many ways but failed.

//code for getting data from JSON
JSONObject obj = object.getJSONObject("data");

//changed web.xml
<?xml version="1.0" encoding="UTF-8"?>

//changed encoding by this
byte ptext[] = myString.getBytes();
String value = new String(ptext, "UTF-8");

Related Questions