title: Sql 2008, invalid character parsing xml with characters with tilde
body: <p>I'm parsing a xml text which contains characters like 'á é ñ'.</p>
  
  <p>I'm getting a 'An invalid character was found in text content.' error, like this</p>
  
  <pre><code>declare @Xml varchar(100)
  
  set @Xml =
  '
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Root&gt;á&lt;/Root&gt;
  '
  
  declare @XmlId integer
  
  execute dbo.sp_xml_preparedocument @XmlId output, @Xml
  
  select * from openXml( @XmlId, '/', 2) with (
    Root varchar(10)
  )
  execute dbo.sp_xml_removedocument @XmlId
  </code></pre>
  
  <p>And I'm getting the following error:</p>
  
  <pre><code>The XML parse error 0xc00ce508 occurred on line number 3, near the XML text "&lt;Root&gt;".
  Msg 6602, Level 16, State 2, Procedure sp_xml_preparedocument, Line 1
  The error description is 'An invalid character was found in text content.'.
  Msg 8179, Level 16, State 5, Line 13
  Could not find prepared statement with handle 0.
  Msg 6607, Level 16, State 3, Procedure sp_xml_removedocument, Line 1
  sp_xml_removedocument: The value supplied for parameter number 1 is invalid.
  </code></pre>
  
  <p>Is there some way that sql can parse this xml? Or the problem is the encoding?</p>
  
  <p>Is the only solution to encode those characters or is there a more elegant way to solve it?</p>