title: Encoding xml and saving to SQL Server
body: <p>Have a Web application that let's you paste text and save it to database.</p>
  
  <p>Text had € (euro currency) symbol and once it got to the database, it crashed while parsing the XML in SQL. Reason is invalid character.</p>
  
  <p>I solved this by using C# to replace € with <code>&amp;#8364;</code> in the Web API. Now XML contains <code>&amp;#8364;</code> and it gets parsed into SQL. I look at the saved row in the database and it shows €. Great!</p>
  
  <p>I go back to the Web application and pull up the text that was saved. I expect to see "€52.9mm" but instead, I see "52.9mm".</p>
  
  <p>I hit F12, refresh and see that it does indeed retrieve "€52.9mm" which is what's stored in the database. But the UI shows "52.9mm".</p>
  
  <p>For kicks, I change the value in the database to <code>&amp;#8364; 52.9mm</code>. A refresh of the UI now shows "€52.9mm".</p>
  
  <p>Would a practical solution be to save the text in the database as <code>&amp;#8364; 52.9mm</code>? </p>
  
  <p>If this works, how do I get it to save in this format which is how it is in the XML? But after it gets parsed by the SQL, it gets saved as €52.9mm.</p>
  
  <p>Is there a better solution?</p>