How to sort out the garbled Chinese display solution for passing values on ASP. NET JavaScript pages

Source: Internet
Author: User
1. ASP. net is flexible, thanks to the text file configuration method. in addition, the method of using page identifiers should be extended from ASP. when writing ASP + programs, I encountered a Chinese display problem. After running the program, I found that all the Chinese characters read by ASP + from the database were changed ?????, Solution:

Method 1:

Set the globalization segment in config. Web
<Configuration>
<Globalization
Requestencoding = "UTF-8"
Responseencoding = "UTF-8"
/>
</Configuration>

It can be UTF-8, gb2312, and so on.

Method 2:

Later, I subscribed to Microsoft's newsgroup and found it discussed in Microsoft's newsgroup DOTNET. Framework. aspplus. General.
To add <% @ codePage = "936" %> to the beginning of each page.
<% @ Page contenttype = "text/html; charset = gb2312" %>
Hurry up and test it. OK !!!

The example is shown below:
<% @ CodePage = "936" %>
<% @ Import namespace = "system. Data" %>
<% @ Import namespace = "system. Data. Ado" %>
<% @ Import namespace = "system. Globalization" %>
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">

Generally, after opening the interface with dereamweaver with vs. net2003, the Chinese characters in the interface become garbled. It took several minutes to finally find a solution.

Add the code in Web. config.
. <Globalization
Requestencoding = "gb2312"
Responseencoding = "gb2312"
Fileencoding = "gb2312"
/>

Or

<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">

Garbled characters after release

2 javescript: encodeuri ('string', 'gb2312 ')

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.