简体   繁体   中英

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:

https://www.mysecurepage.com/Login/login.aspx?lang=en&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. So its just putting a %2B where the + (plus) sign is supposed to be.

Anyway around that in hyperlinks?

Thanks!

In an encoded URL, the + sign represents a space. If you want to preserve the + sign, you need to encode it as %2B . So the URL would look like this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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