ASP. NET question mark change Solution

Source: Internet
Author: User

The first big problem that the author encountered when writing ASP + programs was the problem of Chinese display, after running ASP +, it is found that all the Chinese characters read from the database are changed ?????????????, Similar to this issue in jsp, the most frequently encountered ASP. NET Chinese display problem. I checked the information and found that there are two ways to easily solve the problem of ASP. NET Chinese Question Mark change.

ASP. NET question mark problem solution 1:

After reading the Microsoft NGWS documentation, I found that the FAQ section of this document mentions that you need to add a config. web file

In the web directory, I tried it. The Chinese display is OK.

The method is as follows:

Create a config. web file with the following content in the WEB directory:

 
 
  1. < configuration> 
  2. < globalization   
  3. requestencoding="utf-8"   
  4. responseencoding="utf-8"   
  5. />   
  6. < /configuration> 

Later, I saw a post in the Forum saying that it would be okay to change UTF-8 to gb2312. I have not tried it. You can try it.

ASP. NET question mark problem solution 2:

Later, I subscribed to Microsoft's newsgroup, which is in Microsoft's newsgroup dotnet. framework. aspplus. general found an article discussing this issue, the method is to add <% @ CODEPAGE = "936" %> to the beginning of each page, similar to <% @ page contentType = "text/html; charset = gb2312" %>

Hurry up and test it. OK !!!

The example is shown below:

 
 
  1. < %@ CODEPAGE = "936" %> 
  2. < %@ Import Namespace="System.Data" %> 
  3. < %@ Import Namespace="System.Data.ADO" %> 
  4. < %@ Import Namespace="System.Globalization" %> 
  5. < html> 
  6. < head> 
  7. < meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
  8. < /head> 
  1. Automatic Generation using tools for getting started with ASP. NET 2.0 localization technology
  2. Scope of static variables in ASP. NET Programming
  3. ASP. NET array basics: declarations, representations, and examples
  4. Top 10 skills in ASP. NET Programming II)
  5. Top 10 skills in ASP. NET Programming 1)

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.