If you don't want to remove the vertical tab (hexadecimal value 0x0B) from the string (e.g. database export), you can also set CheckCharacters
to false
in your XmlWriterSettings
.
Gets or sets a value that indicates whether the XML writer should
check to ensure that all characters in the document conform to the
"2.2 Characters" section of the W3C XML 1.0 Recommendation. Returns:
true to do character checking; otherwise, false. The default is true.
e.g.
private static System.Xml.XmlWriter CreateXmlWriter(System.IO.Stream stream)
{
System.Xml.XmlWriterSettings xs = new System.Xml.XmlWriterSettings();
xs.Indent = true;
xs.IndentChars = " ";
xs.NewLineChars = System.Environment.NewLine;
xs.OmitXmlDeclaration = false; // // <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
// xs.Encoding = System.Text.Encoding.UTF8; // doesn't work with pgsql
// xs.Encoding = new System.Text.UTF8Encoding(false);
xs.Encoding = new System.Text.UTF8Encoding(false, false);
xs.Async = true;
xs.CheckCharacters = false;
return System.Xml.XmlWriter.Create(stream, xs);
} // End Function CreateXmlWriter