开发者

How do I prevent the GET method from encoding HTML special characters in the URI?

开发者 https://www.devze.com 2022-12-26 16:27 出处:网络
I have a form using the GET method. If values are submitted with special characters, they appear in 开发者_StackOverflow社区the URI as:

I have a form using the GET method. If values are submitted with special characters, they appear in 开发者_StackOverflow社区the URI as: ?value=fudge%20and%20stuff

How do I make it clean? I don't want to use the header function because this is happening within a page in drupal.


A URL cannot contain spaces and many other "special characters", therefore they get encoded. Unfortunately there isn't a lot you can do about it. The most you could do is some JavaScript trickery in the form, but I don't think it's worth it.


If %20 bothers you, you can substitute (GREP replace) the + character (?value=fudge+and+stuff) for better readability. Otherwise there's not a lot you can do. Other "exotic" characters will be similarly escaped, and need to be.


URL :?value=fudge%20and%20stuff

Encoded as: fulg< space > and < space >stuff

0

精彩评论

暂无评论...
验证码 换一张
取 消