CODEPAGE list and ASP application Example _ Basic Tutorial

Source: Internet
Author: User
The ASP also provides commands to support cultural habits in different regions, such as currency, time, and date formats. As with the string conversion command, use the field command if your script does not use the default site for the WEB server.




The specified code page attribute is invalid.
CodePage property: Is the code page that indicates the page
If you make a Web page script that differs from the default code page on the Web server, you must specify a code page:
The code is as follows:
codepage=936 Simplified Chinese GBK
codepage=950 Traditional Chinese BIG5
codepage=437 US/Canada English
codepage=932 Japanese
codepage=949 Korean
codepage=866 Russian
codepage=65001 Unicode UFT-8
Use of page encoding:
Based on VBScript
VBScript
<% @LANGUAGE = "VBSCRIPT" codepage= "65001"%>
Javascript
<% @LANGUAGE = "JAVASCRIPT" codepage= "65001"%>
Here are some additional notes:
Role
Let ASP read form submission, database and so on with specific encoding.
How to use
Join in the first line of ASP file. Depending on the code page, use the following code:
<%@ codepage=936%> Simplified Chinese
<%@ codepage=950%> Traditional Chinese
<%@ codepage=65001%> UTF-8
Use note
If page A does not have codepage set, and page B and C are set to codepage. When you first visit page A, use IIS default codepage, and then when you visit page B, use the codepage specified by page B, and when you visit page A, you still use the codepage specified by page B, and last visit page C, use the codepage specified in page C.
1252____ Western iso-8859-1
Except when 128-159 was used, use "Windows-1252" iso8859-1, Iso_8859-1, Iso-8859-1, ansi_x3.4-1968, iso-ir-6, ansi_x3.4-198 6, iso_646, irv:1991, iso646-us, US, IBM367, cp367, Csascii, Latin1, iso_8859-1:1987, iso-ir-100, ibm819, cp819, Windows-1 252
20105____ Us-ascii Us-acii, ASCII
28592____ Central European (ISO) iso-8859-2 iso8859-2, Iso-8859-2, Iso_8859-2, Latin2, iso_8859-2:1987, iso-ir-101, L2, CS ISOLatin2
1250____ Central European (Windows) Windows-1250 Windows-1250, x-cp1250
1251____ Cyrillic (Windows) Windows-1251 Windows-1251, x-cp1251
1253____ Greek (Windows) Windows-1253 Windows-1253
1254____ Turkish (Windows) Windows-1254 Windows-1254
932____ Japanese (shift-jis) Shift_JIS Shift_JIS, X-sjis, Ms_kanji, Csshiftjis, x-ms-cp932
51932____ Japanese (EUC) x-euc-jp Extended_unix_code_packed_format_for_japanese, Cseucpkdfmtjapanese, X-EUC-JP, X-EUC
50220____ Japanese (JIS) iso-2022-jp CSISO2022JP, ISO-2022-JP
1257____ Baltic (Windows) Windows-1257 windows-1257
950____ Traditional Chinese (BIG5) Big5 Big5, Csbig5, X-x-big5
936____ Simplified Chinese (GB2312) gb2312 gb_2312-80, iso-ir-58, Chinese, csiso58gb231280, csGB2312, gb2312
20866____ Cyrillic (Koi8-r) Koi8-r cskoi8r, Koi8-r
949____ Korean (KSC5601) ks_c_5601 ks_c_5601, ks_c_5601-1987, Korean, csKSC56011987
1255____ (logical) Hebrew (iso-logical) Windows-1255 iso-8859-8i
1255____ (visual) Hebrew (iso-visual) iso-8859-8 iso-8859-8 visual, Iso-8859-8, Iso_8859-8, visual
862____ Hebrew (DOS) dos-862 dos-862
1256____ Arabic (Windows) Windows-1256 Windows-1256
720____ Arabic (DOS) dos-720 dos-720
874____ Thai Windows-874 Windows-874
1258____ Vietnamese Windows-1258 Windows-1258
65001____ Unicode UTF-8 UTF-8 UTF-8, Unicode-1-1-utf-8, Unicode-2-0-utf-8
65000____ Unicode UTF-7 unicode-1-1-utf-7 utf-7, unicode-1-1-utf-7, Csunicode11utf7, utf-7
50225____ Korean (ISO) iso-2022-kr Iso-2022-kr, CSISO2022KR
52936____ Simplified Chinese (HZ) hz-gb-2312 hz-gb-2312
28594____ Baltic (ISO) iso-8869-4 iso_8859-4:1988, iso-ir-110, iso_8859-4, Iso-8859-4, Latin4, L4, CsISOLatin4
28585____ Cyrillic (ISO) iso_8859-5 iso_8859-5:1988, iso-ir-144, Iso_8859-5, iso-8859-5, Cyrillic, CsISOLatinCyrillic, CsISOLatin5
28597____ Greek (ISO) iso-8859-7 iso_8859-7:1987, iso-ir-126, iso_8859-7, iso-8859-7, elot_928, ECMA-118, Greek, GREEK8, C Sisolatingreek
28599____ Turkish (ISO) iso-8859-9 iso_8859-9:1989, iso-ir-148, iso_8859-9, Iso-8859-9, Latin5, L5, CsISOLatin5
content for Microsoft's ASP Help documentation:

Using International sites
One advantage of publishing messages on the Internet or Intranet is that you can create an internationalized Web site that users can access from different countries or regions. Users can request a webpage that has been localized to a local language and read it using a localized version of the browser. When you build a Web site that contains Web pages in multiple languages, you need to convert the strings that are passed between the browser and the Web server or between ASP scripts and ActiveX components. For example, if a Japanese browser sends a table or query string value in an HTTP request, the string must be converted from the Japanese character set of the browser to the character set that ASP uses to process the script. If all pages on the Web site are written with the default character set used by the Web server, the ASP will automatically convert. However, if the page is written in a different character set, the ASP command must be used to indicate how to convert the string. For example, if your site has both a Japanese character set page and a Web page with a Chinese character set, you must indicate the character set used by ASP to process a particular page.

The ASP also provides commands to support cultural habits in different regions, such as currency, time, and date formats. As with the string conversion command, use the field command if your script does not use the default site for the WEB server.

Set string Conversion code page
A code page is an internal table that the operating system uses to map symbols (letters, numbers, and punctuation marks) to character numbers. Different code pages support the character set used by different countries (regions). code pages are referenced by numbering, for example, code page 932 represents the Japanese character set, and code page 950 represents the traditional Chinese character set.

The Active Server Pages and the ActiveX scripting engine internally use Unicode, a 16-bit fixed-length character encoding standard. If all of the pages you write use the WEB server's default code page, ASP will automatically convert the string. If your script does not use the WEB server's default code page, you should indicate which code page you are using so that strings can be translated correctly when they are passed between the ASP and the scripting engine. Alternatively, you can specify a code page for a string that is passed between the browser and the script or between the ActiveX component and the script.

To specify a code page for an ASP page, you can use the CODEPAGE directive. For example, to set up a Japanese code page, you can use the following directives: <%@ codepage= 932%>
When the ASP processes the content and script for this page, the code page that you specify is used to determine how characters in the script are converted from the character set of your script to Unicode. For example, the value representing the letter "a" in ANSI will be converted to a different value that represents the letter "a" in Unicode.

Active Server Pages assumes that the code page for strings passed between the server and the browser or between scripts and ActiveX components is the same as the code page that you set for the script. To specify a different code page, you can set the Session.CodePage property to override the CodePage setting. For example, you write a script with JIS but respond to a client that uses UTF-8 (JIS and UTF-8 are two different character encodings for the standard Japanese character set). Session.CodePage is set to the value of the CodePage directive by default, and the setting for this property overrides the current CodePage setting. For example, to change the code page to traditional Chinese, you can use the following command:

<% Session.CodePage = 950%>
If you are only temporarily changing the code page of some scripts, be sure to set Session.CodePage to the original value after that. The following script shows how to temporarily change the code page:

<!--Welcome to my home page in Japanese, code page 932--! >
<%@ CodePage = 932%>
...
<% Session ("originalcodepage") = Session.CodePage%>
<!--look up name in Chinese, code page 950--! >
<% Session.CodePage = 950%>
<% sender = Readmailheader ("sender")%>
<% Found = findfriend ("Sender")%>
<!--Restore The original code page--! >
<% Session.CodePage = Session ("Originalcodepage")%>
<% If Found = = TRUE
Replywithpersonalizedform ()
Else
Replywithbusinessform ()
%>
Setting up the field identification
The field is a set of user preference information related to the user's language. The scene determines how to format dates and times, items, how to sort alphabetically, and how to compare strings. The field identification (LCID) is the only 32-bit value that defines the field. If you do not specify a different locale for the script, then ASP will use the default site for the WEB server.

To set the field identity for an ASP page, you can use the LCID directive. For example, to set up a Japanese scene, you can use the following field IDs:

<%@ LCID = 1041%>
The LCID directive tells the ASP to write scripts for the site used. If you want to change the input or output field of a script, you can use the Session.LCID property. For example, to set the field to standard French, use the following command:

<% Session.LCID = 1036%>
The default setting for Session.LCID is the setting of the LCID directive. Setting the value of Session.LCID in the script overrides the default settings.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.