A jquery garbled Solution Process

Source: Internet
Author: User

Today, the children wrote a program and garbled characters. Let's share the solution process:

For convenience, the environment is simplified, vs.net 2003, jquery-1.3.2.js, Web Service call

Simple requests, simple responses, but garbled

Why?

The reason for garbled characters is very simple. It is nothing more than an error in the encoding table. For example, if big5 characters are passed, UTF-8 or UTF-8 is used for receiving the code, but gb2312 is used for decoding.

 

 

 

 

 

 

 

Okay. Check whether the garbled characters are generated during the request.

 

So what I sent is garbled?

 

 

 

Open test.txt under C:/tmp/

 

 

What code is this? Guess it?

 

It seems that the client is correct, and the server is correct. It should be Asp.net's wrong encoding. In the httprequest class, find out if there are any related encoding attributes.

 

 

Look at web. config.

Test the modification to UTF-8.

The reason is found successfully. It seems that the client uploads UTF-8 and the server receives big5 messages.

However, this project cannot be solved in this way, because the old project has been running for a long time and may affect other previous programs. Change the client and set the request attribute to UTF-8, make Asp.net unconfused

Modify Ajax requestCode, Set charset attributes

 

The problem was solved. However, jquery was also used in vs2005 recently, and no garbled characters were found. It may be that vs2005 has already set the default value to UTF-8. (If you have time, find out where the default value is, or let us know about that Tx)

 

Vs. net2003 is the encoding of the Local Operating System by default, such as big5 and gb2312, so garbled characters often occur.

 

In addition, you can share a simple method to view Garbled text files.

 

 

For some text files (such as aspx and CS) that do not end with txt, you can change the suffix to TXT first, and then open ie. Otherwise, ie will not recognize it and download it directly.

 

Too many images. Please forgive us for the slow speed of TX ~~

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.