LCID

The LCID property specifies how dates, times, and currencies are formatted. LCIDs are not the same for each geographical locale. Some locales format dates as YY-MM-DD and some format dates as MM-DD-YYYY. The LCID property is read/write.

Syntax

Session.LCID(= LocaleID)

 

Parameters
LocaleID
An integer that represents the geographical locale. You can find locale integers at MSDN Library.
Remarks

Setting Session.LCID explicitly affects all responses in a session.

If Session.LCID is not explicitly set in a page, it is implicitly set by the AspLCID metabase property. If the AspLCID metabase property is not set, or set to 0, Session.LCID is set by the default system locale.

Session.LCID can be set multiple times in one Web page and used to format data each time. Some locales need the matching codepage to be set to display characters properly. For example, to display dates and times in several locales on one page, the codepage must be set to UTF-8 (65001) to show all the characters.

If you set Response.LCID or Session.LCID explicitly, do so before displaying formatted output. Setting Session.LCID changes the locale for both the ASP application and the scripting engine.  Using the VBScript function setLocale() only changes the locale for the scripting engine.

If the locale of your Web page matches the system defaults of the Web client, you do not need to set a locale in your Web page. However, setting the value is recommended.

If the locale is set in a page, and the codepage is set to display the characters properly, then Response.Charset should also be set. The codepage value tells IIS how to encode the data when building the response, and the charset value tells the browser how to decode the data when displaying the response. The CharsetName of Response.Charset must match the codepage value, or mixed characters are displayed in the browser. Lists of CharsetNames and matching codepage values can be found at MSDN Web Workshop under the columns for Preferred Charset Label and FamilyCodePage.

If you are writing and testing Web pages that use different locales, codepages, and character sets (for example, creating a multi-lingual Web site), remember that your test client computer must have the language packs installed for each language you wish to display. You can install language packs from Regional Options in the Control Panel.

Example

The following example demonstrates setting the locale to British English and using the VBScript FormatCurrency method to display the value 125 as currency with the £ symbol:

<%

  Session.LCID = 2057

  Dim curNumb

  curNumb = FormatCurrency(125)

  Response.Write (curNumb)

%>



Applies To

Session Object

See Also

Charset, CodePage, Accommodating International Clients.


© 1997-2001 Microsoft Corporation. All rights reserved.