I would like to find a better way to do this:
XmlNode nodeXML = xmlDoc.AppendChild(
xmlDoc.CreateXmlDeclaration( "1.0", "utf-8", String.Empty) );
I do not want to think about "utf-8" vs "UTF-8" vs "UTF8" vs "utf8" as I type code. I would like to make my code less prone to typos. I am sure that some standard library has declatred "utf-8"
as a const / readonly string. How can I find it? Also, what about "1.0"? I am assuming that major XML versions have been enumerated somewhere as well.
Thanks!
Try Encoding.UTF8.WebName
.
You can use Encoding.UTF8 from System.Text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With