I have a utility class for sending emails. The emails are generated as html.
I'm having problems with encoding special characters which aren't getting displayed correctly.
However, I can't work out how to use HtmlEncode
as I don't have a current HttpContext
. Is there a .Net
class which will translate special characters to html codes without running under Asp.Net
?
I hope that makes sense, I'm a bit flaky about how all this stuff works. Thanks!
I believe System.Net.WebUtility.HtmlEncode
will provide this functionality. MSDN reference for WebUtility.HTMLEncode