Dealing with invalid XML hexadecimal characters

后端 未结 8 537
不知归路
不知归路 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

提交回复
热议问题