Solution to garbled code of two sub-sites of UTF-8 and GB2312 of the same asp site

Source: Internet
Author: User

ASP program in the same site, if there is a UTF-8 code program, and GB2312 program, after browsing the UTF-8 code page, then browse the GB2312 page, garbled characters are displayed on the page encoded in GB2312.

The problem may be: When you browse UTF-8 encoding, the server outputs html by default using the UTF-8 engine, When you browse the page of GB2312 again, it still uses the UTF-8 to output the page which should be GB2312 encoding. so it will be garbled.

It may be painful to convert them into the same encoding.

Another solution is to keep the original encoding unchanged without any conversion. Add the following in the first line of the Utf-8 program:

 

CODE: 

<% @ LANGUAGE = "VBSCRIPT" CODEPAGE = "65001" %>
<% Session. CodePage = 65001%>

Add

 

CODE: 

<% @ LANGUAGE = "VBSCRIPT" CODEPAGE = "936" %>
<% Session. CodePage = 936%>

This is fine. Of course, if all your programs include a file in the first line, put the above Code in the first line of the file to be included and the problem will be solved immediately.
Session. CodePage specifies which edits the server uses for output. With its declaration, the server will not use the default encoding engine for output.

 

Solution to garbled code of two sub-sites of UTF-8 and GB2312 of the same asp site

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.