Displaying windows-1252 text in a literal control
- by GordonB
I currently have an aspx page that has a placeholder on it.
In the code-behind page i'm adding a literal control to the placeholder controls collection.
The literal control just contains text/html read from a sql server database field.
The only text character encoding i've used so far is UTF-8.
I have the requirement for a specific page to use windows-1252 encoding.
I've strapped this to the page, and browsers now recognise the proper encoding.
<% Response.Charset= "windows-1252" %>
My issue is that i have various german characters ( ö / ü / etc ) that aren't displaying correctly. As presumably they are still be written to the page in UTF-8 not in windows-1252.
I'm looking at;
Dim textEncoder = System.Text.Encoding.GetEncoding(1252)
Which seems to be more geared up to dealing with byte arrays than text.
Do i have to change my text to a byte array then encode as windows-1252 then get the text back out again, or is there a simpler way of achieving what i'm after?