Asp. Two solutions for Chinese display in net

Source: Internet
Author: User
Asp.net| Solution | show | Chinese author just started to write asp+ program when the first big problem is the Chinese display problem, after the run found that asp+ from the database read out of all the Chinese into a?????????????, Somewhat similar to the JSP in this frequency appears the highest Chinese display problem, check the data found that there are two ways to easily solve Chinese problems.



Method One:



After browsing through the Microsoft NGWS document, I found that there is a reference in the FAQ section of the document to add a Config.web file to
Web directory, try it, the Chinese display is OK.
The method is as follows:



Create a file Config.web, as follows, in the web directory
<configuration>
<globalization
Requestencoding= "Utf-8"
Responseencoding= "Utf-8"
/>
</configuration>



Later on the internet to see someone posted in the forum said will Utf-8 replaced gb2312 seems to be able to, the author has not tried, we can try.



Method Two:



Later subscribed to Microsoft's newsgroups and found in Microsoft's newsgroup dotnet.framework.aspplus.general that there was discussion of this
An issue of the article, the method for adding <%@ CODEPAGE = "936"%> to the beginning of each page, somewhat similar to the JSP in the
<%@ page contenttype= "text/html;charset=gb2312"%>
Quickly tested it, sure enough!!!



Examples are shown below:
<%@ CODEPAGE = "936"%>
<%@ Import namespace= "System.Data"%>
<%@ Import namespace= "System.Data.ADO"%>
<%@ Import namespace= "System.Globalization"%>
<meta http-equiv= "Content-type" content= "text/html; charset=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.