1

I am getting a string "lb/in&sup2" (which I want to show as lb/in²) from server. I want to decode this and show it in my Xamarin.iOS app.

I tried:

System.Net.WebUtility.HtmlDecode("lb/in&sup2")

but its not working, still shows as "lb/in&sup2".

Drunken Daddy
  • 7,326
  • 14
  • 70
  • 104

1 Answers1

1

Html entity should end with ";" character. This should work fine:

System.Net.WebUtility.HtmlDecode("lb/in²");

If you are getting string exactly as you posted - you should fix the side which you are getting this string from, because "&sup2" is not html entity, it's just a "&sup2" string.

Evk
  • 98,527
  • 8
  • 141
  • 191