Discussing the problem of garbled page passing parameters in iframe _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
The abnormal and uncommon parameter garbled problem occurs. When you click it, the webpage address with parameters is passed. Because the parameters I pass are Chinese characters, garbled characters are obtained at the backend. Unusual parameter garbled characters are encountered.
First, check the page.

, The monthly indicators also have the same three radio.
Under the three radio categories, there is an iframe. The effect is that different radio pages are displayed,
The webpage address with parameters is passed when you click.

(1) The problem arises. When "Daily indicator" and "monthly indicator" are switched, garbled characters are obtained in the background because the parameters I pass are Chinese characters,
Therefore, the parameter is encoded with encode, and the background UrlDecode is decoded. the depressing result is garbled.
Then, we carefully compare the page encoding and find that the page opened by iframe is not encoded.
Add the following sentence to the page:

The Code is as follows:




It seems that the "Daily indicator" and "monthly indicator" pages are displayed normally, and the parameters are passed.

(2) An abnormal problem occurred. when I switched to radio, an error was reported and the parameter changed to garbled characters.
I really don't know what went wrong this time. The "Daily indicator", "monthly indicator", and the JS method on the radio click switch page use the same one.
Depressed, confused, found as follows:
When you click "Coal Bed Methane", the page is normal. When you click "oil production", the parameter is incorrect. When the oil production is selected, click "Oil Production". The page is displayed normally.
I don't think so.
Then compare the "coal-bed methane" and "oil production", and I have hung up the official page of the "oil production" module. The "coal-bed methane" module is just a casual Baidu page. Due to the problem (1) encoding, the first thing I think about is encoding. Check Baidu encoding as follows,

The Code is as follows:




The encoding format is different. So I also hung the "Coal Bed Methane" Page and removed Baidu.
Yes. The page is running normally and no parameter garbled characters are reported.

Analyze the cause: It seems that the current iframe display page encoding is obtained when the parameter is passed, but it has nothing to do with the page encoding to be opened.
However, this is really not the case. It is an iframe. On the iframe parent page, I assign a url value to iframe and PASS Parameters to take care of the current page of iframe?

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.