%40 on click turns to %2540

做~自己de王妃 提交于 2020-01-01 09:40:10

问题


when the link is clicked containing the @ symbol, the url gives me %40, which is what I want. But once I click it, one second later it changes to %2540 right after I click. The click is within an email, then directed to the site, where %40 changes to %2540. How can I make it stop changing?

it is getting the params like this now:

$email=Yii::app()->request->getParam('email');

not sure what other information i should provide.


回答1:


The issue is that your %40 is url-encoded again (since % encodes to %25), which gives you %2540.




回答2:


There's not enough detail in your question to work out exactly why, but I can tell you at least what it is that's going on, and that should give you some clues.

A "@" has an ASCII code of hex 40, so when it gets escaped (i.e., turned into something without any special characters in it), it becomes "%40". But a "%" has an ASCII code of hex 25. If you escape a "%", you get "%25".

Your text is getting escaped twice: first to go from "@" to "%40", and then again to go from "%40" to "%2540".




回答3:


It happens when you are trying to call urlencode on a query string when you've already done it. So, the first call gives you %40 instead of "@". And the second call gives you %25 instead of %



来源:https://stackoverflow.com/questions/25393229/40-on-click-turns-to-2540

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!