title: How to encode special characters in XML
body: <p>My string XML contains a whole series of special characters:</p>
  
  <pre><code>&amp;amp;
  egrave;
  &amp;amp;
  rsquo;
  &amp;amp;
  rsquo;
  &amp;amp;
  rsquo;
  &amp;amp;
  ldquo;
  &amp;amp;
  rdquo;
  &amp;amp;
  rsquo
  &amp;amp;
  agrave;
  &amp;amp;
  agrave;
  </code></pre>
  
  <p>I need replace this special characters in insert string in DB and I tried use <strong>System.Net.WebUtility.HtmlEncode</strong> without success, can you help me?</p>
  
  <pre><code>string sql = "insert into rss (title, description, link, pubdate) values (?,?,?, " +
               " STR_TO_DATE(?, '%a, %d %b %Y %H:%i:%s GMT'));";
  
  OdbcCommand command;
  OdbcDataAdapter adpter = new OdbcDataAdapter();
  connection.Open();
  command = new OdbcCommand(sql, connection);
  command.Parameters.AddWithValue("param1", System.Net.WebUtility.HtmlEncode(xmlTitle.InnerText.ToString()));
  command.Parameters.AddWithValue("param2", System.Net.WebUtility.HtmlEncode(xmlDescription.InnerText.ToString()));
  command.Parameters.AddWithValue("param3", System.Net.WebUtility.HtmlEncode(xmlLink.InnerText.ToString()));
  command.Parameters.AddWithValue("param4", System.Net.WebUtility.HtmlEncode(xmlPubDate.InnerText.ToString()));
  adpter.InsertCommand = command;
  adpter.InsertCommand.ExecuteNonQuery();
  connection.Close();
  </code></pre>