Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert the following text into a proper string in C#? [duplicate]

Tags:

string

c#

decode

How to convert the following text into a proper string in C#?

<IconStyle xmlns="http://earth.google.com/kml/2.0"><color>FFFFFFFF</color><scale>1.0</scale><Icon><href>root://icons/palette-5.png</href><x>192</x><y>192</y><w>32</w><h>32</h></Icon></IconStyle><LabelStyle xmlns="http://earth.google.com/kml/2.0"><scale>0</scale></LabelStyle><BalloonStyle xmlns="http://earth.google.com/kml/2.0"><text>$[description]</text><color>FFFFFFFF</color></BalloonStyle>

Forgot to mention the important catch:how to convert the string in a console application in c#?

like image 651
Carsen Avatar asked Dec 05 '22 22:12

Carsen


2 Answers

That is HTML encoded, so:

HttpUtility.HtmlDecode(myHtmlEncodedString);

Reference: http://msdn.microsoft.com/en-us/library/7c5fyk1k.aspx

like image 184
BFil Avatar answered Dec 24 '22 09:12

BFil


HttpUtility.HtmlDecode(string)
like image 43
MadBender Avatar answered Dec 24 '22 11:12

MadBender