I'm inserting some text into a SQL Server database using some C#. I'm using System.Web.HttpUtility.HtmlEncode() to attempt to replace characters that aren't compatible with the charset of my db (set to default collation = SQL_Latin1_General_CP1_CI_AS), but it is not helping me with some "weird" characters.
For example, this dash character: ― is different from the standard dash character. (-)
HtmlEncode() doesn't replace the first dash with an entity (I think it is "—") and it ends up as a "?" in my database.
What is the best way to clean / sanitize a text field before inserting into SQL Server?
I would rather not change my database configuration / collation.