开发者

What is the correct way to encode + and & characters in URL

开发者 https://www.devze.com 2022-12-20 22:29 出处:网络
I have WCF REST service which retrieves tags from database. Some tags have special chars like &, +, #, (, ) in them. I am able to retrieve tags with #, (, and ) by url encoding the query string.

I have WCF REST service which retrieves tags from database. Some tags have special chars like &, +, #, (, ) in them. I am able to retrieve tags with #, (, and ) by url encoding the query string.

But I am not able to retrieve tags with 开发者_开发知识库'&' and '+' by url encoding the query string.

I would like to know the solution for this.

Thanks


Convert

+ => %2b
& => %26
, => %2c

UPDATE:

But for "#" its impossible, because, anything after # character is not send to server side, you could only do that in client side with javascript


a+b is written as a%2Bb

a&b is written as a%26b

0

精彩评论

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

关注公众号