encodeURIComponent in c sharp

别说谁变了你拦得住时间么 提交于 2019-12-13 04:46:50

问题


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.


回答1:


You are looking for HttpUtility.UrlPathEncode.

See this SO question: Server.UrlEncode vs. HttpUtility.UrlEncode



来源:https://stackoverflow.com/questions/7545622/encodeuricomponent-in-c-sharp

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