How to: Select an Encoding for ASP.NET Web Page Globalization
Internally, the code behind ASP.NET Web pages handles all string data as Unicode. You can set how the page encodes its response, which sets the CharSet attribute on the Content-Type part of the HTTP header. This enables browsers to determine the encoding without a meta tag or having to deduce the correct encoding from the content. You can also set how the page interprets information that is sent in a request.
Finally, you can set how ASP.NET interprets the content of the page itself — in other words, the encoding of the physical .aspx file on disk. If you set the file encoding, all ASP pages must use that encoding. Notepad.exe can save files that are encoded in the current system ANSI codepage, in UTF-8, or in UTF-16 (also called Unicode). The ASP.NET runtime can distinguish between these three encodings. The encoding of the physical ASP.NET file must match the encoding that is specified in the file in the encoding attributes.To specify encoding
To set the encoding for all pages, add a property to the Web.config file, and then set its fileEncoding, requestEncoding, and responseEncoding attributes, as shown in the following example:
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="en-US"
uiCulture="de-DE"
/>
To set the encoding for an individual page, set the RequestEncoding and ResponseEncoding attributes of the @ Page directive, as shown in the following example:
You cannot set the fileEncodingattribute, because it applies to the file itself.
[@more@]來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/13651903/viewspace-1038445/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- How to: Set the Culture and UI Culture for ASP.NET Web Page GlobalizationUIASP.NETWeb
- HTML Layout Guidelines for ASP.NET Web Page GlobalizationHTMLGUIIDEASP.NETWeb
- ASP.NET Web Page Resources OverviewASP.NETWebView
- [Encoding]How to do proper encoding output redirection on cmd.exe?Encoding
- How to redirect to a specific web page after sign out from Entra IDWeb
- How the web worksWeb
- Web Page Marker Pen All In OneWeb
- Globalization Support Parameters in Views (178)View
- How Users Read on the Web (轉)Web
- Spring Boot Web Error Page處理Spring BootWebError
- Assign Shortcut key for ASP.Net Page Using JavascriptASP.NETJavaScript
- How to enable Large Page Feature on AIX-Based Systems [ID 372157.1]AI
- Dweb.page - 通往分散式Web的入口Web分散式
- Web效能優化:What? Why? How?Web優化
- asp.net中Page.ClientScript.RegisterStartupScript用法小結ASP.NETclient
- ASP.NET Page函式呼叫順序及解釋ASP.NET函式
- How to access a remote web service by Camel CXF endpointREMWeb
- YLazy Web Page Test , 網頁效能測試平臺Web網頁
- ASP.NET的Page.IsPostBack 屬性詳細說明(轉)ASP.NET
- ASP.NET Web API 特性ASP.NETWebAPI
- ASP.NET Web API 路由ASP.NETWebAPI路由
- ASP.NET Web Garden模型ASP.NETWeb模型
- How to resolve ORA-19706 error when select from dblinkError
- [特徵工程] encoding特徵工程Encoding
- ASP.NET Web API實踐系列01,以ASP.NET Web Form方式寄宿ASP.NETWebAPIORM
- ASP.NET Web API與Rest web api(一)ASP.NETWebAPIREST
- ## HTTP系列之Accept-Encoding和Content-EncodingHTTPEncoding
- Web 開發學習筆記(5) — 抽象出 Page 類Web筆記抽象
- R12 - Unable To Select And Add Existing Contacts On Customers Standard Page At Sites Level
- [求助]tomcat,web.xml,<error-page>,亂碼TomcatWebXMLError
- How to: Use Resources to Set Property Values in Web Server ControlsWebServer
- How do I initialize Log4J in a web application?WebAPP
- 【ASP.NET Web API教程】2 建立各種Web APIASP.NETWebAPI
- 使用 Web 標準生成 ASP.NET 2.0 Web 站點WebASP.NET
- ASP.NET Web Pages – 物件簡介ASP.NETWeb物件
- ASP.NET Web Forms – 事件簡介ASP.NETWebORM事件
- ASP.NET Core Web API 介面限流ASP.NETWebAPI
- ASP.NET Core Web API 與 SSLASP.NETWebAPI