The processing experience _javascript technique of garbled in JavaScript
Source: Internet
Author: User
Common garbled situation: 1. The client submits the data to the backstage, the parameter value has the garbled situation, like: a.aspx?value= "The Chinese Value" &type= "%$# (&_ special symbol";
2. Background read data to the client after garbled;
3. Some files between the JS reference or CSS style is invalid.
Summarize the solution: First: To ensure that the project-related file format encoding (that is, save as format) unified for Utf-8, especially the relevant CSS,JS file format strongly recommended unified for UTF-8;
Second: JS involved in the parameter submission, transmission, there may be Chinese, ' _ ' underline, special symbol of the place, with Escape () code after transmission;
Third: If the database has previously been stored in different encoded data, in the relevant display data in the background of the page request, Response contentencoding attribute code set to "Utf-8"
So, garbled will not reappear.
Other netizens reply:
With Google Clsure compiler compiled, you can convert Chinese into Unicode expression, with what code does not matter.
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