Home > Article > Web Front-end > Solution to garbled Chinese parameters passed in get request when loading iframe dynamically_javascript skills
When the user's page needs to dynamically load an iframe,
If the src of the iframe contains Chinese parameters, an encoding error will occur; it must be encoded and then decoded.
Encoding: encodeURI(encodeURI("String containing Chinese"))
Decoding: java.net.URLDecoder.decode("String that needs to be decoded", "utf-8");
Solution
Use encodeURI('Chinese') for encoding operation,
js code: