C# StringWriter encoding issues
I'm using a StringWriter to construct a CSV from a GridView to email/output to the user, and I'm开发者_如何学运维 having some issues outputting the '£' (GBP) sign - currently when it reads it from the GridView, it reads it as £
, and this doesn't get encoded to the correct sign in the CSV. If I do a string replace of the ASCII code with the actual symbol, I get a little closer - the symbol appears but it also has an accented 'A' before the symbol.
Any ideas?
£
is the HTML Character entity for £
, so I don't know why a StringWriter
would know about it.
You need to convert from HTML to text first, for example with HttpUtility.HtmlDecode
.
精彩评论