Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have developed an android application that has functionality of display Hindi font and its get from server database so i used json parsing and created mysql php web services but problem is when i parse the data its showing HTML code like श्रीजी in my text view in devices so what is the reason for it ......


public static String executeHttpPost(String url,
ArrayList<namevaluepair> postParameters) throws Exception {

BufferedReader in = null;
InputStream is = null;

try {

HttpClient client = getHttpClient();

HttpPost request = new HttpPost(url);

// UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(
// postParameters);

UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(
postParameters);

request.setEntity(formEntity);
String jsonText = EntityUtils.toString(formEntity, HTTP.UTF_8);

HttpResponse response = client.execute(request);

in = new BufferedReader(new InputStreamReader(response.getEntity()
.getContent()));

// in= new BufferedReader(new
// InputStreamReader(response.getEntity().getContent(),"UTF-8"));
StringBuffer sb = new StringBuffer("");

String line = "";

String NL = System.getProperty("line.separator");

while ((line = in.readLine()) != null) {

sb.append(line + NL);

}

in.close();
String result = sb.toString();
return result;






postParameters.add(new BasicNameValuePair("temple_id", "2"));

String response = null;

try {
response = CustomHttpClient.executeHttpPost(url_temple,
postParameters);

String result = response.toString();

try {
JSONArray jArray = new JSONArray(result);
for (int i = 0; i < jArray.length(); i++) {
JSONObject json_data = jArray.getJSONObject(i);
temple_name = json_data.getString("temple_name");
website = json_data.getString("temple_web");
phone = json_data.getString("temple_phone");
about_temple = json_data.getString("about_text");
}

}

catch (JSONException e) {
Log.e("log_tag", "Error parsing data " + e.toString());
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900