Unicode escape characters not being read by XmlReader
I've got an XML document that I'm importing into an XmlReader that has some unicode formatting I need to preserve. I'm preserving the whitespace but it开发者_如何学Python's dropping the encoded #x2028 which I assume should be expressed as a line break.
Here's my code:
var settings = new XmlReaderSettings
{
ProhibitDtd = false,
XmlResolver = null,
IgnoreWhitespace = false
};
var reader = XmlReader.Create(new StreamReader(fu.PostedFile.InputStream), settings);
var document = new XmlDocument {PreserveWhitespace = true};
document.Load(reader);
return document;
XML example:
<td valign="top" align="center">Camels and camel 
resting place</td>
How do I get to those characters to I can render br tags?
Your question is unclear: do you expect the XmlReader to translate the 

into an HTML <br>
tag? That isn't going to happen.
Or are you examining the actual character content of the <td>
element (within the code, not as printed/displayed) and seeing "camel resting place"? If yes, please show the code that you're using to verify this, because it would be a pretty major bug.
Or something else?
After importing the code into the reader I was able to find and replace that character:
Regex.Replace(s, "\u2028", "<br/>");
精彩评论