KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
i'm creating a XDocument like this: XDocument doc = new XDocument( new XDeclaration("1.0", "utf-8", "yes")); when i save the document like this ( doc.Save(@"c:\tijd\file2.xml"); ) , i get this: <?xml version="1.0" encoding="utf-8" standalone="yes"?> which is ok. but i want to return the content as xml, and i found the following code: var wr = new StringWriter(); doc.Save(wr); string s = (wr.GetStringBuilder().ToString()); this code works, but then the string 's' starts with this: <?xml version="1.0" encoding="utf-16" standalone="yes"?> so it changed from utf8 to utf16, and that's not what i want, because now i can't read it in internet explorer. Is there a way to prevent this behaviour?
Tags (comma-separated)
Save Edits
Cancel