Today I encountered a very magical problem. The user told me that the form on this website cannot get the return value after being submitted to the query system. The query result is 0 records, but the value can be searched for by the local pure html execution. I verified it myself and it turns out that this is true. Moreover, comparing the parameters submitted by GETs on both sides, except for the different values of the fields, the number of parameters is the same, so it may be considered that it may be the impact of the encoding problem.
After opening the two files separately, I found that the encodings on both sides were indeed inconsistent, and the server was GB2312. The parameters passing UTF-8 encoding could not be parsed normally in the past, so I let the dog search and find a rarely used property on the form.
The code copy is as follows:
accept-charset=”gb2312″
This property is very interesting. You can set the form to encode the content, so just add this property to form.
But it's very disgusting. IE does not support this property, so I had to hack the onSubmit() method of the form and add
The code copy is as follows:
onsubmit=”document.charset='gb2312';"
The problem is completely solved.