A process of solving Jquery garbled code Illustrated tutorial_jquery
简单的请求,简单的响应,但是乱码产生了
Why?
乱码之所以产生,原因很简单,无非就是编码表用错了,如传的是big5字符,接收却使用utf-8,或utf-8编码,却用GB2312解码。
好吧,先确认一下是否请求过程中产生的乱码
那我发过去的是乱码吗?
打开C:/tmp/下的test.txt
这是什么编码,猜一猜?
看来客户端没错,且正确地到了服务器端了,那应该是asp.net搞错了编码了,HttpRequest类里找下有没有相关的Encoding相关的属性
看看web.config吧
测试一下修改成utf-8看看
原因成功找到,看来就是客户端传utf-8,然后服务器端big5接收产生问题
不过这个专案不能这样解决,因为这个旧专案跑了很久了,改这里可能影响以前的其它程式,那就改客户端吧,设置请求属性为utf-8,让asp.net不迷茫
修改ajax请求代码,设定charset属性
问题得以解决,不过最近也有在vs2005中使用jquery,没有发生乱码,可能是vs2005已经默认为utf-8了(有空再去找下是在哪里默认的,或那位TX告知一下)
vs.net2003默认是本机操作系统的编码,如big5,gb2312,因此常常发生乱码问题.
Also, share a simple method to view garbled text files.
For some text files that do not end with txt (such as aspx, cs), you can change the suffix to txt first, and then open IE to view it, otherwise IE will not recognize it, so download it directly
There are too many pictures, please forgive me if the TX speed is slow~~

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Title: Methods and code examples to solve the problem of garbled characters when importing Chinese data into Oracle. When importing Chinese data into Oracle database, garbled characters often appear. This may be due to incorrect database character set settings or encoding conversion problems during the import process. . In order to solve this problem, we can take some methods to ensure that the imported Chinese data can be displayed correctly. The following are some solutions and specific code examples: 1. Check the database character set settings In the Oracle database, the character set settings are

Win11 is Microsoft's latest operating system, but some users may encounter the problem of displaying garbled characters when booting, which will affect the normal use of the system. This article will introduce some methods to solve this problem. Method 1: 1. Press the [Win+S] key combination, or click the [Search icon] next to the start icon on the taskbar. In the opened Windows search, enter [Control Panel] in the search box, and then click [Open]. The best matching control panel application out of the control panel window; 2. In the control panel window, switch to the [Category] view mode, and then click [Clock and Zone-Region]; 3. In the zone window, switch to the [Management] tab, and then click [Change] System Regional Settings]; 4. [Uncheck] Beta version: Use Unicode

How to deal with the problem of garbled characters in the Linux terminal. When using the Linux system, sometimes the text displayed in the terminal will be garbled. This brings inconvenience to us when using the terminal and needs to be dealt with in time. This article will introduce how to deal with some common Linux terminal garbled problems, and provide specific code examples. Problem 1: Garbled Chinese characters on the terminal. Garbled Chinese characters on the terminal are usually caused by incorrect character encoding settings on the terminal. We can solve this problem by modifying the terminal's character encoding settings. #View the current terminal

How to use PUT request method in jQuery? In jQuery, the method of sending a PUT request is similar to sending other types of requests, but you need to pay attention to some details and parameter settings. PUT requests are typically used to update resources, such as updating data in a database or updating files on the server. The following is a specific code example using the PUT request method in jQuery. First, make sure you include the jQuery library file, then you can send a PUT request via: $.ajax({u

Strategies and techniques for solving Chinese garbled characters in Oracle database. In actual database applications, many developers or administrators may encounter the problem of Chinese garbled characters in Oracle database. When the data in the database is garbled, it not only affects the correctness and readability of the data, but also brings many problems to the system. This article will combine specific code examples to introduce the strategies and techniques for solving Chinese garbled characters in Oracle database to help readers better understand and solve this problem. 1. The reason for garbled characters is inconsistent character sets: database connection and application

Title: jQuery Tips: Quickly modify the text of all a tags on the page In web development, we often need to modify and operate elements on the page. When using jQuery, sometimes you need to modify the text content of all a tags in the page at once, which can save time and energy. The following will introduce how to use jQuery to quickly modify the text of all a tags on the page, and give specific code examples. First, we need to introduce the jQuery library file and ensure that the following code is introduced into the page: <

Title: Use jQuery to modify the text content of all a tags. jQuery is a popular JavaScript library that is widely used to handle DOM operations. In web development, we often encounter the need to modify the text content of the link tag (a tag) on the page. This article will explain how to use jQuery to achieve this goal, and provide specific code examples. First, we need to introduce the jQuery library into the page. Add the following code in the HTML file:

PHP is a back-end programming language widely used in website development. It has powerful database operation functions and is often used to interact with databases such as MySQL. However, due to the complexity of Chinese character encoding, problems often arise when dealing with Chinese garbled characters in the database. This article will introduce the skills and practices of PHP in handling Chinese garbled characters in databases, including common causes of garbled characters, solutions and specific code examples. Common reasons for garbled characters are incorrect database character set settings: the correct character set needs to be selected when creating the database, such as utf8 or u
