title: C# Encode a string with multiple types of characters to HTML
body: <p>I have a doubt that I am not even sure what kind of doubt it is. I'll just explain it.</p>
  
  <p>I need to convert a string, in C# Windows forms, that might have any kind of characters to HTML format. I need this to use an existing tool with my program, so it has to be exactly like this.</p>
  
  <p>The problem is that the <code>HtmlEncode</code> function doesn't work as intended. I found a website that does EXACTLY what I need. That website is: <a href="http://web.forret.com/tools/html.asp" rel="nofollow">http://web.forret.com/tools/html.asp</a> .</p>
  
  <p>In this website when I post the string: </p>
  
  <pre><code>"® € ì Ù Ω µ drokluží zlůd paněž  Ř  ř common text"
  </code></pre>
  
  <p>and convert it to html I get:</p>
  
  <pre><code>"&amp;#174; &amp;#8364; &amp;#236; &amp;#217; &amp;amp;#937; &amp;#181; droklu&amp;#382;&amp;#237; zl&amp;amp;#367;d pan&amp;amp;#283;&amp;#382;  &amp;amp;#344;  &amp;amp;#345; common text"
  </code></pre>
  
  <p>and I need to obtain EXACTLY THE SAME in C#. Note that, when I ask the convertion, the original text changes to:</p>
  
  <pre><code>"® **€ ì Ù &amp;#937; µ drokluží zl&amp;#367;d pan&amp;#283;ž  &amp;#344;  &amp;#345; common text**"
  </code></pre>
  
  <p>so I believe that a pre-conversion is done before the final conversion. I just can't find which.</p>
  
  <p>Note that <code>HTMLEncode</code> produces</p>
  
  <pre><code>"&amp;#174; € &amp;#236; &amp;#217; Ω &amp;#181; drokluž&amp;#237; zlůd paněž  Ř  ř common text"
  </code></pre>
  
  <p>which doesn't even convert some symbols like <code>€</code> <code>Ω</code> or the foreign text <code>zlůd paněž  Ř  ř**</code>.</p>
  
  <p>I already lost a huge ammount of time in this, so any kind of help would be extremelly appreciated. I hope the question was clear enough.</p>