Save Forms in Appropriate Character Sets
ASP and HTML pages can be saved in the target language for the form, or a multilingual Unicode transformation format (UTF). The charset attribute, part of the HTTP-EQUIV meta tag, specifies the character set in which the HTML page is encoded. When the localized ASP and HTML are saved in UTF, the application can support Microsoft® Internet Explorer 5 and later browsers. The application needs another set of forms encoded with language-specific character sets to support browsers that do not support UTF. The following metadata example shows the HTML-encoding UTF and the page language (el) for an HTML page.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Language" content="el">
There are two ways to accommodate the HTML-encoding requirements and the limitations of different browsers: browser-specific form registrations and the Exchange store Form object.
Form registrations that specify browser and version properties can implement ASP and HTML pages that are specific to a browser and a browser version. The character set encoding in each page ensures the best user experience for a particular browser. For example, the character set for an HTML form that is registered to support Internet Explorer 4.0 in Japanese is Shift-JIS and the form registration for Internet Explorer 5 specifies an HTML form where the character set is set UTF. The following examples show the browser and majorver properties for two form registration entries. The first example shows how a request from an Internet Explorer 4.0 browser is directed automatically to an HTML form named MyForm.htm, which is for encoded for Shift-JIS. The second example shows how a request from an Internet Explorer 5 and later browser is directed automatically to an HTML form named MyForm1.htm. MyForm1.htm is encoded for UTF.
<form:browser>IE</form:browser> <form:majorver>=4</form:majorver> <form:formurl>MyForm.htm</form:formurl>
<form:browser>IE</form:browser> <form:majorver>>=5</form:majorver> <form:formurl> MyForm1.htm </form:formurl>
The WSS Form Object
The Exchange store Form object provides a more flexible approach to properties. The CodePage property specifies the character set that will be used when the form renders. The language code identifier (LCID) property specifies the locale that will be used for data formatting when the form renders. The CodePage property is read/write and the code page for the form can conditionally be modified, before the form renders. For example, the script in the ASP form can use information from the HTTP_USER_AGENT header to identify the appropriate character set for the browser. The following example shows script that identifies browsers and browser versions to conditionally set the CodePage property. The script sets the code page to UTF when the request is from Internet Explorer 5 or later.
<% Dim objBrowsCap Dim IsMSIE5Plus Set objBrowsCap = Server.CreateObject("MSWC.BrowserType") IsMSIE5Plus = (objBrowsCap.browser = "IE" and objBrowsCap.version > 4) ... oForm.CodePage = IIf(IsMSIE5Plus, "utf-8", strCodePage) %>
The LCID property is read/write and the LCID for the form can be modified conditionally, before the form renders. It can be useful to set the LCID dynamically when users share a language but locale preferences specify different data formats. For example, Exchange Web forms that are localized for English in the United States can be deployed for users with language preferences such as English for the United Kingdom and English for New Zealand. However, locale differences can make it necessary to format data by locale at run time. For example, the United States uses a short date format like M/d/yyyy and the United Kingdom a short date format like dd/MM/yyyy. The following example shows script that sets the LCID to 2057, the locale identifier (ID) for the United Kingdom.
<% ... oForm.LCID = 2057 ... %>