开发者

HTMLEncode in Winforms

开发者 https://www.devze.com 2023-01-15 10:57 出处:网络
I have a Winform application in which I am checking if a fully qualified file name c:\\somefolder\\my file name.txt exists in the XML.

I have a Winform application in which I am checking if a fully qualified file name c:\somefolder\my file name.txt exists in the XML.

Unfortunately, the XML holds the strings html encoded so c:\somefolder\my file name.txt becomes c:/somefolder/my%20file%20name.txt (not the change from backsl开发者_如何学Goash to forwardslash, and the %20 instead of blankspace).

How do I HTMLEncode strings in my winform app?


try

System.Web.HttpUtility.HtmlEncode(foo);

you will need to add a reference to System.Web.dll


You may also Try Uri.EscapeDataString(STRING_HERE) (No reference required), works in Asp.net & WinForms.

0

精彩评论

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

关注公众号