Home >Web Front-end >JS Tutorial >Solution to the problem of garbled page form data in different encodings_javascript skills
I encountered a very magical problem today. A user told me that the form on the website here does not get a return value after it is submitted to the query system. The query result is 0 records, but the results of the local pure HTML execution can be searched. to the value. I verified it myself and found that it was indeed the case, and compared the parameters submitted by GET on both sides. Except for the value of one field that was different, the number of parameters was the same, so it was considered that it might be caused by encoding issues.
After opening the two files respectively, I found that the encoding on the two sides was indeed inconsistent, and the server side was GB2312. The parameters passed UTF-8 encoding could not be parsed normally in the past, so I searched and found a rarely used one on the form. properties.
But it’s disgusting. IE does not support this attribute, so I had to hack the onSubmit() method of the form and add