ASP.NET and UTF-8 problem

  • Thread starter Thread starter Andrei
  • Start date Start date
A

Andrei

Hi,
I have a simple html page with russian text and the encoding is UTF-8. I
have changed the extension of the page to aspx to add some code in the page
and i can't see the russian text. Also I've tried to add the directive <%@
CODEPAGE="65001" %> but there is no changes. How can I solve this problem?
 
Andrei said:
Hi,
I have a simple html page with russian text and the encoding is
UTF-8. I have changed the extension of the page to aspx to add some
code in the page and i can't see the russian text. Also I've tried
to add the directive <%@ CODEPAGE="65001" %> but there is no
changes. How can I solve this problem?

It's not clear to me what CodePage really does. I guess it's just a hint
for the ASP.NET runtime how the actual .aspx file is encoded (similar to
the way encodings are decalred in XML), but I don't think it has any
effect on the actual output sent to the client. Have you set

<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>

in your web.config or do you use
Response.ContentEncoding = new System.Text.UTF8Encoding(); ?

Maybe the ASP.NET runtime reads the file correctly but applies another
encoding to the actual output stream.

And make sure your browser has encoding autodetection enabled ;-)

Cheers,
 
Back
Top