Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

What should I do to change one aspx page to have utf-8 encoding?

my web.config has the following code:

<system.web>
  <globalization
     requestEncoding="utf-8"
     responseEncoding="utf-8"/>
</system.web>

Tried this:

meta http-equiv="Content-Type" content="text/html; charset=UTF-8" 

doesn't work.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
154 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try this;

<configuration>
 <system.web>
  <globalization
    fileEncoding="utf-8" 
    requestEncoding="utf-8" 
    responseEncoding="utf-8"
    culture="en-US"
    uiCulture="de-DE"
   />
 </system.web>
</configuration>

To set the encoding for an individual page, set the RequestEncoding and ResponseEncoding attributes of the @ Page directive:

<%@ Page RequestEncoding="utf-8" ResponseEncoding="utf-8" %>

Or you can use location like this:

<location path="home.aspx">
    <system.web>
        <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
    </system.web>
</location>

Read more: How to: Select an Encoding for ASP.NET Web Page Globalization.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...