Is there a standard literal constant that I can use instead of "utf-8" in C# (.Net 3.5)?

Posted by Hamish Grubijan on Stack Overflow See other posts from Stack Overflow or by Hamish Grubijan
Published on 2010-05-11T17:26:19Z Indexed on 2010/05/11 17:34 UTC
Read the original article Hit count: 251

Filed under:
|
|
|
|

Hi,

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!

© Stack Overflow or respective owner

Related posts about c#

Related posts about Xml