Culture Encoding
The
culture encoding attributes in your Web.config file determine many aspects of
your .NET application, including currency, date, and number format. Your application uses these settings at
run-time to determine proper operation.
Since these culture encoding attributes are used by the .NET Framework,
Iron Speed Designer does not use them directly when generating your
application. However, a discussion of
them is included here due to their importance in localizing your application.
The
culture encoding attributes are in the configuration section of Web.config, for
example:
<configuration>
<system.web>
<globalization
fileEncoding="utf-8"
requestEncoding="utf-8"
responseEncoding="utf-8"
/>
</system.web>
</configuration>
To
assist you in localizing your application for multiple cultures, you can
instruct Iron Speed Designer to build your application for a particular culture
via the Application Information screen of the Application Wizard in Iron Speed
Designer.
The
following localization and culture encoding attribute information is from
Microsoft’s “Setting the Culture and UI Culture for Web Forms Globalization.”
|
Attribute
|
Description
|
|
Culture
uiCulture
|
By specifying a culture it is possible to use a set of common
preferences for information like strings and date and number formats that
correspond to users' cultural conventions.
A Web Forms page has two culture values, Culture and UICulture. The Culture value determines or influences
results of culture-dependent functions, such as displaying the date. The UICulture value determines how the
resources are loaded for the form and is used for culture-specific lookup of
resource data. The only purpose of the
UICulture value is to indicate the language the resources should load, that
is, determine which language the UI strings should use. The Culture value determines everything
else — date formatting, number formatting, and so on.
The
two culture settings do not need to have the same value. Depending on your application, it may be
important to set them separately. An
example is a Web auction site. The UI
culture changes for each Web browser, but the culture stays constant, so
prices are always displayed in the same currency and formatting.
The
Culture value can only be set to specific cultures such as en-US or
en-GB. This prevents the problem of
identifying the correct currency symbol to use for "en", where
en-US and en-GB have different currency symbols.
|
|
fileEncoding
|
Specifies the default encoding for .aspx, .asmx, and .asax file
parsing. Unicode and UTF-8 files saved
with the byte order mark prefix will be automatically recognized regardless
of the value of fileEncoding.
|
|
requestEncoding
|
Specifies the assumed encoding of each incoming request,
including posted data and the query string.
If the request comes with a request header containing an
Accept-Charset attribute, it overrides the requestEncoding in
configuration. The default encoding is
UTF-8, specified in the <globalization> tag included in the
Machine.config file created when the .NET Framework is installed. If request encoding is not specified in a
Machine.config or Web.config file, encoding defaults to the computer's
Regional Options locale setting. In
single-server applications, requestEncoding and responseEncoding should be the
same. For the less common case (multiple-server
applications where the default server encodings are different), you can vary
the request and response encoding using local Web.config files.
|
|
responseEncoding
|
Specifies the content encoding of responses. The default encoding is UTF-8, specified in
the <globalization> tag included in the Machine.config file created
when the .NET Framework is installed. If
response encoding is not specified in a Machine.config or Web.config file,
encoding defaults to the computer's Regional Options locale setting. In single-server applications,
requestEncoding and responseEncoding should be the same. For the less common case (multiple-server
applications where the default server encodings are different), you can vary
the request and response encoding using local Web.config files.
|
For
more detail, see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskeditingwebconfigfileforwebformsglobalization.asp
|

|
|
An example Show Order Table page with set
to display certain dates and currencies in localized formats.
|
Here
are the localization settings for the Show Order Table page shown above. The Web.config globalization entry is set to “fr-FR”
which, in turn, causes the Euro currency symbol to be used since the Euro is
the official currency in France. Similarly, the DD/MM/YYYY European date
format is used.
<!--
GLOBALIZATION
This section sets the globalization
settings of the application.
-->
<globalization
fileEncoding="utf-8"
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="fr-FR"
uiCulture="fr-FR"
/>
See Also
Localizing
(Internationalizing) Your Application