How do I preserve special characters when writing XML with XDocument.Save()?

前端 未结 4 1841
再見小時候
再見小時候 2021-01-22 22:01

My source XML has the copyright character in it as ©. When writing the XML with this code:

var stringWriter = new StringWriter();
segment         


        
4条回答
  •  爱一瞬间的悲伤
    2021-01-22 22:24

    i had the same problem when saving some lithuanian characters in this way. i found a way to cheat around this by replacing & with & (© to write © and so on) it looks strange but it worked for me :)

提交回复
热议问题