views:

470

answers:

1

Hi there.

I need to decode HTML entities, e.g. from ö to ö, and & to &.

URLEncoder.decode(str) does not do the job (convert from % notations). TextUtils has a HTMLencode, but not a HTMLdecode.

Are there any function for decoding HTML entities?

Regards, Johan

+6  A: 

The Html class is supposed to do that, however it is said that everything is not supported. It always worked for me but I never had ö so I can't tell for this one. Try Html.fromHtml(yourStr) to get the decoded string.

Sephy
Thanks Sephy, that worked like a charm.
johboh
And this is soo retarded since I have to do thisng like `Html.fromHtml(Html.fromHtml((String) body).toString());` Why can't they just add Html.decode?
DroidIn.net