Winforms 中的 HTMLEncode
我有一个 Winform 应用程序,在其中检查 XML 中是否存在完全限定的文件名 c:\somefolder\my file name.txt
。
不幸的是,XML 保存了 html 编码的字符串,因此 c:\somefolder\my file name.txt
变成 c:/somefolder/my%20file%20name.txt
(不是从反斜杠更改为正斜杠,并用 %20 代替空格)。
如何在 winform 应用程序中对字符串进行 HTMLEncode?
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 backslash to forwardslash, and the %20 instead of blankspace).
How do I HTMLEncode strings in my winform app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您也可以尝试 Uri.EscapeDataString(STRING_HERE) (无需参考),适用于 Asp.net 和WinForms。
You may also Try Uri.EscapeDataString(STRING_HERE) (No reference required), works in Asp.net & WinForms.
尝试
您需要添加对 System.Web.dll 的引用
try
you will need to add a reference to System.Web.dll