Dealing with invalid XML hexadecimal characters

后端 未结 8 534
不知归路
不知归路 2020-12-05 11:10

I\'m trying to send an XML document over the wire but receiving the following exception:

\"MY LONG EMAIL STRING\" was specified for the \'Body\' element. ---         


        
相关标签:
8条回答
  • 2020-12-05 11:43
    byte[] toEncodeAsBytes
                = System.Text.ASCIIEncoding.ASCII.GetBytes(toEncode);
          string returnValue
                = System.Convert.ToBase64String(toEncodeAsBytes);
    

    is one way of doing this

    0 讨论(0)
  • 2020-12-05 11:44

    Can't the string be cleaned with:

    System.Net.WebUtility.HtmlDecode()
    

    ?

    0 讨论(0)
提交回复
热议问题