Solution to garbled code displayed on the ASP page/set encoding in ASP
Source: Internet
Author: User
If you find garbled characters appear during page browsing. You can try to make sure that the page itself is correctly formatted: for example, use charset = UTF-8 in test. asp, first make sure that the file itself is Utf-8 encoded. You can use Notepad for conversion. If charset = GBK is used, make sure that the file is GBK encoded.
Confirm the encoding method of the original data (such as the data obtained from the database) and the page encoding method 1.
Specify the encoding used by IIS to read data.
<% @ CodePage = 65001%> UTF-8
<% @ CodePage = 936%> Simplified Chinese
<% @ CodePage = 950%> traditional Chinese
<% @ CodePage = 437%> American/Canadian English
<% @ CodePage = 932%> Japanese
<% @ CodePage = 949%> Korean
<% @ CodePage = 866%> Russian
CodePage specifies the encoding used by IIS to read data.
For example, using UTF-8 encoding, add <% @ Language = "VBScript" codePage = "65001" %> at the top of the file
For example, if you use GBK encoding, add <% @ Language = "VBScript" codePage = "936" %> at the top of the file.
Sets the encoding of ASP built-in object symbol ing and response Content-Type Header
If you use UTF-8 encoding ArticleAdd:
<% Session. codePage = 65001
Response. charset = "UTF-8" %>
If you use GBK encoding, add:
<% Session. codePage = 936
Response. charset = "GBK" %>
Note that you can put the settings mentioned in 3, 4 at the top of a public-contained file (such as Conn. asp. This attribute is applied to all pages.
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