Encountered a very unusual parameter garbled problem
First look at the page
As shown in the picture, there are the same three radios under the monthly indicators.
Below the three radios is an iframe. The effect is that clicking on different radios displays different pages.
When clicked, the web page address with parameters is passed.
(1) The problem came out. When switching between "Daily Indicator" and "Monthly Indicator", because the parameters I passed were Chinese characters, they were obtained as garbled characters in the background.
So I set the parameters. encode and UrlDecode in the background. I was depressingly surprised to find that the code was still garbled.
Then I carefully checked the encoding of the page and found that the page to be opened in the iframe was not encoded.
So add the following sentence to the page
It seems to be fine now, switch "Daily Indicators" and " The "Monthly Indicators" webpage can be displayed normally, and the parameters are also passed.
(2) But a perverted problem occurred. When I switched the radio, an error was reported and the parameters became garbled.
I really don’t know what’s wrong this time. “Daily Indicators”, “Monthly Indicators” and the JS method of clicking to switch pages on the radio use the same JS method.
When I was depressed, I messed around and found the following:
When I clicked "Coalbed Methane", the page was normal, and then when I clicked "Oil Production", the parameters were wrong. I clicked "Oil Production" again when oil production was already selected. , the page is displayed normally
Imagine it shouldn’t be like this
Then I compared "coal bed methane" and "oil production". I have put the "oil production" module on the official page, but the "coal bed methane" module has not been built yet. Randomly hang up the Baidu page. Due to the encoding problem in question (1), the first thing I thought of was the encoding problem. Check the Baidu encoding as follows,
Encoding The format is different. So I also put "coalbed methane" on the page of "oil production" and removed Baidu.
Well, the page is running normally and the parameters are no longer garbled.
Analyze the reason: It seems that when passing parameters, what is obtained is the encoding of the current iframe display page, which has nothing to do with the encoding of the page to be opened.
But, it really shouldn’t be like this. It is an iframe. I assign a URL to the iframe and pass parameters on the parent page of the iframe. What does it matter about the current page of the iframe?