简体   繁体   English

如何防止特殊字符在超链接URL中进行解析/编码?

[英]How to prevent special characters from parsing/encoding in hyperlink URLs?

Is it possible to prevent special character from being encoded into an escape character? 是否可以防止特殊字符被编码为转义字符?

For example, I have a URL that contains the necessary parameters for the user to auto login to somewhere like so: 例如,我有一个URL,其中包含必要的参数,以便用户自动登录到类似这样的地方:

https://www.mysecurepage.com/Login/login.aspx?lang=en&un=user1+test@gmail.com&pw=mypassword https://www.mysecurepage.com/Login/login.aspx?lang=zh-TW&un=user1+test@gmail.com&pw=mypassword

So after user click on that hyperlink on the page, it says the credentials are incorrect because it tried to log them in as user1%2Btest@gmail.com. 因此,在用户单击页面上的该超链接之后,它说凭据不正确,因为它试图以user1%2Btest@gmail.com的身份登录。 So its just putting a %2B where the + (plus) sign is supposed to be. 因此,仅将%2B放置在+(加号)应该位于的位置。

Anyway around that in hyperlinks? 无论如何,在超链接中?

Thanks! 谢谢!

In an encoded URL, the + sign represents a space. 在编码的URL中, +号表示空格。 If you want to preserve the + sign, you need to encode it as %2B . 如果要保留+号,则需要将其编码为%2B So the URL would look like this: 因此,URL如下所示:

https://www.mysecurepage.com/Login/login.aspx?lang=en&un=user1%2Btest%40gmail.com&pw=mypassword

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM