admin管理员组文章数量:1415491
I've tried to use HttpUtility.UrlEncode in order to simulate the javscript's encodeURIComponent, but had some issues (instead of getting "%20" i got "+")
then I've replaced the string, but i see that the problem is not only in these two signs, in some places the encoded string (by UrlEncode) is totally different from the encoded string by using encodeURIComponent.
Any ideas how it can be solved ?
thanks.
I've tried to use HttpUtility.UrlEncode in order to simulate the javscript's encodeURIComponent, but had some issues (instead of getting "%20" i got "+")
then I've replaced the string, but i see that the problem is not only in these two signs, in some places the encoded string (by UrlEncode) is totally different from the encoded string by using encodeURIComponent.
Any ideas how it can be solved ?
thanks.
Share Improve this question asked Sep 25, 2011 at 12:57 IgalIgal 4,78314 gold badges45 silver badges70 bronze badges 4- 3 Possible duplicate: stackoverflow./questions/86477/… – as-cii Commented Sep 25, 2011 at 13:01
- it's not a duplicate, as i said, my problem is not in "+" or "%20%" but in wrong encoding... when i use c# encoder, i get different chars than the encodeURIComponent encoding... – Igal Commented Sep 25, 2011 at 13:18
-
2
What if you try
Uri.EscapeUriString("some uri...")
? – as-cii Commented Sep 25, 2011 at 20:52 - 1 Possible duplicate of Does C# have an equivalent to JavaScript's encodeURIComponent()? – Adrian Commented Sep 19, 2018 at 4:04
1 Answer
Reset to default 1You are looking for HttpUtility.UrlPathEncode.
See this SO question: Server.UrlEncode vs. HttpUtility.UrlEncode
本文标签: cencodeURIComponent in c sharpStack Overflow
版权声明:本文标题:c# - encodeURIComponent in c sharp - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745208633a2647759.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论