c# 4.0 wpf html decode is not correctly decoding special characters - System.Net.WebUtility.HtmlDecode

2.9k views Asked by At

The text i am trying to decode Anasayfa > OEM Ürünleri > Ekran Kartları > SAPPHIRE

Alright this is how i am trying

 string srCategory = System.Net.WebUtility.HtmlDecode(nodeCategory.InnerText.ToString()).ToString().Trim();

The result: Anasayfa > OEM �r�nleri > Ekran Kartlar� > SAPPHIRE

So why it is not working ? thank you.

c# 4.0 wpf application

1

There are 1 answers

3
Adam Tuliper On BEST ANSWER

This works for me. This is correct, no?

string srCategory = System.Net.WebUtility.HtmlDecode("Anasayfa > OEM Ürünleri > Ekran Kartları > SAPPHIRE").ToString().Trim();

My current culture is EN-US, whats yours, I can try to duplicate and update here although I really don't think that matters here at all.

Are you certain its just not a display issue in whatever you are trying to display? Its not an encoded character so it shouldn't change upon decode.