草庐IT

utf-8 - 如何让 Microsoft 的 AntiXss 库 URLEncode 为 URI 标准(RFC3986)而不是 IRI(RFC3987)?

我正在使用MicrosoftAntiXss3.1库。我们有许多使用非拉丁文字的国际网站。我们使用的是SEO友好的URL,因此我们在URL中包含非ASCII字符。AntiXss.UrlEncode(至少在3.1中)将“国际字符”视为安全的,因此我们最终得到一个IRI而不是URI:http://somesite.com/ja-JP/applications/search/セキュリティ-b200009HttpUtility.UrlEncode为URI(RFC3986)生成正确的编码:http://somesite.com/ja-JP/applications/search/%e3%82%bb

html - AntiXss.HtmlEncode 与 AntiXss.GetSafeHtmlFragment

谁能告诉我这两者的区别?AntiXss.HtmlEncode()对比AntiXss.GetSafeHtmlFragment() 最佳答案 HtmlEcode实际上编码标签:AntiXss.HtmlEncode("hello");//Output:<b>hello</b><script>GetSafeHtmlFragment(AntiXssv4.0)返回标签完整的HTML片段:Sanitizer.GetSafeHtmlFragment("hello2")//Output:hello2更新许多人考虑最