I am getting some response from server in text format, it's working fine but in some cases i didn't get string as it is.
Explanation:- My db have one name like cupcaké but when i parse data it's show me cupcaké
. I want to show as it is like cupcaké
.
I tried URL.Encode
and URL.Decode
function with the help of utf-8
but none of them helpful. I need universal solution which work for all special character not only for this character.
Here is my jsonparser class, can i need to make changes in this file? or somewhere?
HttpURLConnection conn = null;
StringBuilder jsonResults = new StringBuilder();
try {
URL url = new URL(str);
conn = (HttpURLConnection) url.openConnection();
InputStreamReader in = new InputStreamReader(conn.getInputStream());
// Load the results into a StringBuilder
int read;
char[] buff = new char[1024];
while ((read = in.read(buff)) != -1) {
jsonResults.append(buff, 0, read);
}
json = jsonResults.toString();
} catch (MalformedURLException e) {
Log.e(LOG_TAG, "Error processing Places API URL", e);
How can i show as it is on my screen?
Please give me any reference or hint.