Cross browser url parameter with utf8 possible?
-
12-06-2021 - |
Question
1.May i know is all modern browsers support to user address parameter like http://abc.com?something=UTF8chactersHERE ?
2.which browser does not support it?
3. can javascript parse the parameter properly on all browser?
example : http://abc.com?something=环保部&something2=环保部
Solution
You should percent-escape the UTF-8 representation of the characters:
http://abc.com/?something=环保部&something2=环保部
becomes
http://abc.com/?something=%E7%8E%AF%E4%BF%9D%E9%83%A8&something2=%E7%8E%AF%E4%BF%9D%E9%83%A8
Any modern browser will display the second as the first in the URL bar.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow