I’m reading a file into a jsonobject from my assets folder. The file contains json string.
Some of the strings contain “‘” (apsotrophe) character. The problem is that the textview shows “?” in place of these apostrophes. Why is this happening. When I print the json string to logcat using mJsonObject.toString(), it shows proper character.
How can I get rid of this “?” and show actual character?
The Apostrophe probably isn’t a simple
'apostrophe, but some advanced typographic apostrophe that is missing in your font and/or gets mangled during charset conversions. Preferably, replace the typographic apostrophes with plain apostrophes in the JSON file.If you don’t want to do so, escape them using the
\uescape. This makes sure that the correct character ends up in the JsonObject. If you still get the question mark, make sure your font supports the character and that you don’t break it in other charset conversions.If you cannot use
\uescapes for some reason, make sure you read the file with the correct charset.