I have this simple problem: once I retrieve a mail text, sometimes it happens that Html.fromHtml cannot parse correctly the string.
I’ll give you an example. This is the HTML string:
––––&
It needs to be something like this:
–––––––––––––––––––––––––––
Is there a way in Android to achieve that? Do I need to use Regular Expressions?
Thank you so much.
You can filter out the hidden characters (in this case) with:
After that it’s just:
And it will work in html context. Or if you want the real em dash characters:
Demo of the concept: http://jsfiddle.net/CGzDc/ (javascript, you will have to use code in this answer for java)