Solution to garbled problem of Utf-8 and Gb2312 encoding in ASP page code declaration

Source: Internet
Author: User

1ASP program in the same site, if there is UTF-8 encoded program, and GB2312 encoded program, when browsing utf-8 encoded page, then browse the current site GB2312 page, GB2312 encoded page will appear garbled2The problem is that when you browse UTF-8 encoding, the server defaults to using the UTF-8 engine to output HTML, and when you re-browse the GB2312 page, it's utf-The 8来 output should be a GB2312 encoded page, so it will be garbled. 3 4 5 6 first, let's take a look at the session object that provides four properties. 71.CodePage Read/write. Integral type. 8 defines the code page that is used to display the page content in the browser. A code page is a numeric value of a character set, and different languages and places may use different code pages. For example, ANSI code page 1252 is used for U.S. English and most European languages. Code page 932 is used for Japanese text. (This is the attribute we're going to use here.)92.LCID Read/write. Integral type. TenDefines the page region identification (LCID) that is sent to the browser. The LCID is an international standard abbreviation that uniquely identifies a region, for example, 2057 defines the currency symbol for the current region as ' £ '. The LCID can also be used in statements such as FormatCurrency, as long as there is an optional LCID parameter. The LCID can also be used in ASP processing instructions <%...%>and takes precedence over the setting in the session's LCID property. A list of ASP processing instructions is provided later in this chapter One3.SessionID read-only. Long integer type.  A returns the session identifier for this session, which is generated by the server when the session is created. Unique within the lifetime of the parent Application object, so it can be reused when a new application is started -4.Timeout Read/write. Integral type.  - defines the time-out period in minutes for this session. If the user does not refresh or request a Web page during the timeout period, the session ends. Can be modified as needed on each page. The default value is 10min. The time should be shorter on sites with high usage rates!  the  - here are some common ANSI code pages -<%@ Codepage=65001%>utf-8 -<%@ codepage=936%>Simplified Chinese +<%@ codepage=950%>Traditional Chinese -<%@ codepage=437%> USA/Canadian English +<%@ codepage=932%>Japanese A<%@ codepage=949%>Korean at<%@ codepage=866%>Russian -  -  - Let's talk about how to solve the problem and how to use it. -Common file conn used in a Web site program.Add the following code to the ASP: -  in1, Gb2312 code page Add -<% @LANGUAGE = "VBSCRIPT" codepage= "936"%> to<%Session.CodePage=936%> + last add more -<%response.charset = "BG2312"%> the  *  $2. Add <% @LANGUAGE the UTF-8 encoding page = "VBSCRIPT" codepage= "65001"%>Panax Notoginseng<%Session.CodePage=65001%> -<%response.charset = "Utf-8"%> the  +This is the simplest and most effective method.

Solution to garbled problem of Utf-8 and Gb2312 encoding in ASP page code declaration

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.