Android parsing special characters in json response

In my Android app, I get a JSON response string with PHP url. from the answer I get the names of the hotels with apostrophe, I get the symbol 'instead apostrophe. How can I make out a hotel with special characters in android?I can see the apostrophe in the browser but could not see in android logcat.

I tried jresponse = URLEncoder.encode(jresponse,"UTF-8");, but I could not get apostrophefor the name of the hotel.

This is the name of the hotel in response.

 I see the following in browser.

    {"id":12747,
     "name":"Oscar's",
     ....
    }
But in the logcat:

     id 12747
     name Oscar's
+4
source share
3 answers

Use decoder instead of encoder.URLDecoder.decode(jresponse,"UTF-8")

0
source

ISO-8859-2, URLEncodedEntity, . .

, , UTF-8/UTF-16 ( ), -.

EDIT: , ISO-8859-2 . , - . http://en.wikipedia.org/wiki/ISO/IEC_8859-2

0

You can try the Html class. for example: - jresponse = Html.fromHtml (jresponse);

0
source

Source: https://habr.com/ru/post/1530977/


All Articles