Search code examples
androidspecial-charactersapostrophe

Apostrophe converting to question mark in textview


I am parsing some external XML into an object and displaying this inside a textview.

Apostrophe's/single quotes are being converted to these silly question mark symbols.

Nothing i've found is working - i've tried using replaceall and escaping it with \', it doesn't give me the desired result.

I've tried setting the textview using:

tv.setText(Html.fromHtml(news_item.getTitle()));

It doesn't seem to work, I can't find any other solutions to this one, your ideas appreciated.


Solution

  • Try this:

    tv.setText(news_item.getTitle().replaceAll("\u2019", "'"));
    

    For other Unicode characters, please see this link.