CODEPAGE list and asp example _ basic tutorial

Source: Internet
Author: User
ASP also provides commands that support cultural habits in different regions, such as currency, time, and date formats. Like the String Conversion command, if your script does not use the default field of the Web server, use the field command. ASP also provides commands that support cultural habits in different regions, such as currency, time, and date formats. Like the String Conversion command, if your script does not use the default field of the Web server, use the field command.

The specified code page feature is invalid.
Codepage attribute: indicates the webpage code page.
If the webpage script is different from the default code page of the WEB server, you must specify the 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" %>
Below are some additional instructions:
Function
Allows ASP to read form submissions and databases with specific codes.
Usage
Add it to the first line of the ASP file. Use the following code based on different code pages:
<% @ Codepage = 936%> Simplified Chinese
<% @ Codepage = 950%> traditional Chinese
<% @ Codepage = 65001%> UTF-8
Usage notes
If codepage is not set for webpage A, and codepage is set for webpage B and C. When accessing webpage A, use the default IIS codepage; when accessing webpage B, use the codepage specified by webpage B; when accessing webpage A, use the codepage specified by webpage B; finally, access page C and use the codepage specified by Page C.
1252 ____ Western iso-8859-1
When t when 128-159 is used, use "Windows-1252" iso8859-1, iso_8859-1, iso-8859-1, ANSI_X3.4-1968, iso-ir-6, ANSI_X3.4-1986, ISO_646, irv: 1991, ISO646-US, us, IBM367, cp367, csASCII, latin1, iso_8859-1: 1987, iso-ir-100, ibm819, cp819, Windows-1252
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, csISOLatin2
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 ____ japan ese (Shift-JIS) shift_jis, x-sjis, ms_Kanji, csShiftJIS, x-ms-cp932
51932 ____ japan ese (EUC) x-euc-jp Extended_UNIX_Code_Packed_Format_for_Japanese, csEUCPkdFmtJapanese, x-euc-jp, x-euc
50220 ____ japan ese (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, latin4, l4, csISOLatin4
28585 ____ Cyrillic (ISO) iso_8859-5: 1988, ISO_8859-5, iso-ir-144, ISO_8859-5, cyrillic, csISOLatinCyrillic, csISOLatin5
28597 ____ Greek (ISO) iso-8859-7: 1987, ISO_8859-7, iso-ir-126, ISO_8859-7, ELOT_928, ISO-8859-7, greek, greek8, csISOLatinGreek
28599 ____ Turkish (ISO) iso-8859-9: 1989, ISO_8859-9, iso-ir-148, ISO_8859-9, latin5, l5, csISOLatin5
Content of Microsoft ASP help document:

Use international sites
One advantage of Publishing messages over the Internet or Intranet is that you can create an international Web site that users can access from different countries (regions. You can apply for a webpage that has been localized to a local language and read it using the localized version of your browser. When creating a Web site that contains Web pages of multiple languages, you need to convert the strings transmitted 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 ASP is used to process the script. If all pages on the Web site are written using the default character set used by the Web server, ASP will automatically convert. However, if a webpage is written in another character set, you must use the ASP command to specify how to convert the string. For example, if your website contains both Japanese and Chinese character sets, you must specify the character set used by ASP to process a specific page.

ASP also provides commands that support cultural habits in different regions, such as currency, time, and date formats. Like the String Conversion command, if your script does not use the default field of the Web server, use the field command.

Set String Conversion code page
The code page is an internal table that is used by the operating system to map symbols (letters, numbers, and punctuation marks) to character numbers. Different code pages support character sets used by different countries (regions. The code page is referenced by serial numbers. For example, the Code Page 932 represents the Japanese character set, and the code page 950 represents the traditional Chinese character set.

The Active Server Pages and ActiveX script engines use Unicode internally, which is a 16-Bit fixed-length character encoding standard. If all pages you write use the default code page of the Web server, ASP will automatically convert the string. If your script does not use the default code page of the Web server, you should specify the code page used so that the string can be correctly converted during transmission between ASP and the script engine. In addition, you can specify the code page for the string passed between the browser and the script or between the ActiveX component and the script.

To specify a code page for an ASP page, use the CODEPAGE command. For example, to set the Japanese code page, run the following command: <% @ CODEPAGE = 932%>
When ASP processes the content and scripts on this page, it uses the code page you specified to determine how to convert the characters in the script 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 representing the letter "a" in Unicode.

Active Server Pages assumes that the code page of the string passed between the Server and the browser or between the script and ActiveX component is the same as the code page you set for the script. To specify different code pages, you can set the Session. CodePage attribute to overwrite the CODEPAGE setting. For example, you use JIS to write scripts, but you have to respond to customer programs that use UTF-8 (JIS and UTF-8 are two different character encodings of the standard Japanese character set ). Session. CodePage is set to the value of the CODEPAGE command by default. The setting of this attribute overwrites the current CODEPAGE setting. For example, to change the code page to traditional Chinese, run the following command:

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


<% @ CodePage = 932%>
...
<% Session ("OriginalCodePage") = Session. CodePage %>

<% Session. CodePage = 950%>
<% Sender = ReadMailHeader ("Sender") %>
<% Found = FindFriend ("Sender") %>

<% Session. CodePage = Session ("OriginalCodePage") %>
<% If Found = TRUE
ReplyWithPersonalizedForm ()
Else
ReplyWithBusinessForm ()
%>
Set field ID
The site is a set of user preferences related to the user language. The site determines how to format the date and time, project, how to sort by letter, and how to compare strings. The LCID is a unique 32-bit field value. If you do not specify a different site for the script, ASP uses the default site of the Web server.

To set an on-site identity for an ASP page, use the LCID command. For example, to set a Japanese field, you can use the following field ID:

<% @ LCID = 1041%>
The LCID command informs ASP of the site where the script is written. If you want to change the input or output field of the script, you can use the Session. LCID attribute. For example, to set the site to standard French, run the following command:

<% Session. LCID = 1036%>
Session. LCID is set to LCID by default. Setting Session. LCID in the script overwrites the default setting.

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.