I've a problem whereby the XML that I've generated contains:
<attribute name="Actors">Trevante Rhodes , André Holland , Janelle Monáe</attribute>
but it should be this:
<attribute name="Actors">Trevante Rhodes , André Holland , Janelle Monáe</attribute>
@IntelliData's answer to the question posted here seems to suggest that the only solution is to replace them with their HTML encoded counter parts.
So... if I have a source file that may contain any foreign character from one or more countries, does this mean that I'd have to write a routine to do just that?
And if I have no choice, is there a more efficient way to do this search and replace?
myData = myData.Replace("À","À").Replace("à","à").Replace(...)
MORE INFO
To create the XML file, I am using
using (StreamWriter sw = new StreamWriter(myTxtFile))
{
...
}
myTxtFile thus contains
Trevante Rhodes , André Holland , Janelle Monáe , Ashton...
I then open the .txt file using:
using (StreamReader sr = new StreamReader(mySourceFile, Encoding.GetEncoding("iso-8859-1")))
{
...
some processing to assign the data to XML nodes...
...
}
and finally create the XML file:
using (StreamWriter sw = new StreamWriter(xmlDataFilename, false, Encoding.GetEncoding("utf-8")))
{
...
myXMLObject.outerXml
...
}
which produces this:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<productRequest>
<attribute name="Actors"> Trevante Rhodes , André Holland , Janelle Monáe , Ashton...</attribute>
</productRequest>
MORE INFO 2
The answer to the search and replace question lies here