17.1. Localizing Request/Response Encoding
You are developing an application for a specific region, and you want to tell the browser which character set to use in rendering the page.
responseEncoding attributes of the
<globalization> element in web.config to the desired character set:
<globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" /></system.web>
The HTTP header returned to the browser in response to a request contains information not displayed but, nevertheless, controls how the browser displays the content it receives. Included in the header is information that specifies which character set has been used to encode the response data and, by implication, which character set the browser should use to display it.
The request and response encoding information for a page request can be viewed by setting the
Trace attribute of the
@ Page directive to
true and viewing the Request Details section.
ASP.NET lets you specify the character set used to encode the response data using the
responseEncoding attribute of the
<globalization> element in the web.config file, as shown earlier. The
responseEncoding attribute can be set to any valid character set. Table 17-1 lists some of the more common character sets used for European languages (English, French, German, and others).
Table 17-1. Common character sets
Character set name
Commonly called Latin 1; covers the Western European ...