Reputation: 127
I have a c# Windows application. The app read data from web service in xml format and parse the xml. The xml is utf-8 encoding, but some node of the xml have different encoding. How can i read nodes correct encoding.
<?xml version="1.0" encoding="UTF-8"?><rem:RetrievalNonRetrievalByRecipient xmlns:rem="http://uri.etsi.org/02640/v1#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:tsl="http://uri.etsi.org/02231/v2#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Id="c20d2520-5eb4-4ac0-8944-7deb2cf3de89" version="1"><rem:RecipientsDetails>
<rem:EntityDetails>
<tsl:ElectronicAddress>
<tsl:URI>&quot;ASİL HAVACILIK GENEL M�œD�œRL�œ�ž�œ&quot; &lt;[email protected]&gt;</tsl:URI>
</tsl:ElectronicAddress>
</rem:EntityDetails>
Upvotes: 2
Views: 649
Reputation: 173
Read data from ws then find the correct node then read and convert.
string sXML = Encoding.UTF8.GetString(bary); doc.LoadXml(sXML);
string sNode = oSelectNodes[0].InnerText;
sNode = System.Web.HttpUtility.HtmlDecode(sNode);
sNode = Encoding.UTF8.GetString(Encoding.GetEncoding("iso-8859-9").GetBytes(sNode));
Upvotes: 3