title: Dealing with invalid XML hexadecimal characters
body: <p>I'm trying to send an XML document over the wire but receiving the following exception:</p>
  
  <pre><code>"MY LONG EMAIL STRING" was specified for the 'Body' element. ---&amp;amp;gt; System.ArgumentException: '&amp;#x2;', hexadecimal value 0x02, is an invalid character.
     at System.Xml.XmlUtf8RawTextWriter.InvalidXmlChar(Int32 ch, Byte* pDst, Boolean entitize)
     at System.Xml.XmlUtf8RawTextWriter.WriteElementTextBlock(Char* pSrc, Char* pSrcEnd)
     at System.Xml.XmlUtf8RawTextWriter.WriteString(String text)
     at System.Xml.XmlUtf8RawTextWriterIndent.WriteString(String text)
     at System.Xml.XmlRawWriter.WriteValue(String value)
     at System.Xml.XmlWellFormedWriter.WriteValue(String value)
     at Microsoft.Exchange.WebServices.Data.EwsServiceXmlWriter.WriteValue(String value, String name)
     --- End of inner exception stack trace ---
  </code></pre>
  
  <p>I don't have any control over what I attempt to send because the string is gathered from an email. How can I encode my string so it's valid XML while keeping the illegal characters?</p>
  
  <p>I'd like to keep the original characters one way or another.</p>