views:

22

answers:

1

Hello,

I am trying to show a simple text RSS feed from a CodePlex project in a window.
My problem is that the feed text contains a lot of character sequences that looks like:

:
-
etc..

I know that they represent the punctuation and some special chars, with some kind of encoding, but I do not know how I can convert them back to simple ascii chars... I mean, without a switch/case covering each special char of course.

Thank you !

Sum-up: How can I convert "My name is : Aurelien" to "My name is : Aurelien" ?

+1  A: 

As you can see by the question generated by your markup, those are HTML encoded characters.

All you have to do to decode them is use HttpUtility.HtmlDecode() to decode them.

If you're using .NET 4.0, you could also use System.Net.WebUtility.HtmlDecode() which would allow you to continue to target the Client Profile rather than the full framework.

Justin Niessner
Your right ! Thank you. Too bad this class is located in the System.Web namespace and thus forces me to switch from a Client Profile target to a full .NET target.
Aurélien Ribon
@Aurélien - If you're using .NET 4, you can use System.Net.WebUtility which should still let you target Client Profile: http://msdn.microsoft.com/en-us/library/system.net.webutility.aspx
Justin Niessner
And I'm using it. So I guess there is an answer for everything. Thank you very much, sir !
Aurélien Ribon