I have xml file with encoding="UTF-8" at the beginning
and inside it I have the following:
<item id="item1" href="%d8%a7%d9%84%d8%ad%d9%84%d9%88%d9%8a%d8%a7%d8%aa%20%d8%a7%d9%84%d8%b3%d9%87%d9%84%d8%a9%20%d8%a7%d9%84%d8%aa%d8%ad%d8%b6%d9%8a%d8%b1.html"/>
Value of href refers to an html file. This file has filename in Arabic and it appears as mentioned above in the xml file.
What encoding do I use in my C# code to get the Arabic value of this string
I don't think the file encoding of the XML declaration matters for that "href" attribute value, that more looks like the percentage encoding found in URIs. So try whether
System.Uri.UnescapeDataString(XElement.Load("file.xml").Descendants("item").First(el => (string)el.Attribute("id") == "item1").Attribute("href").Value)
gives you the value you expect. So basically the method of System.Uri needs to be applied to the attribute value. And I used LINQ to XML to read out that attribute value.
MVP Data Platform Development
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?