C# .NET和html实体
当我试图用Tidy.NET清理HTML代码时,它破坏了HTML实体,如C# .NET和html实体,c#,.net,html-entities,tidy,C#,.net,Html Entities,Tidy,当我试图用Tidy.NET清理HTML代码时,它破坏了HTML实体,如e@或和#x73并使HTML不可读。我尝试了不同的设置,但都没有成功 有人知道如何解决这个问题吗?是否存在修补程序 编辑1: 我使用这个Tidy的配置 Tidy doc = new Tidy(); doc.Options.DocType = DocType.User; doc.Options.Xhtml = true; doc.Options.WrapScriptlets = true; doc.Options.
e代码>@代码>或和#x73编码>并使HTML不可读。我尝试了不同的设置,但都没有成功
有人知道如何解决这个问题吗?是否存在修补程序
编辑1:
我使用这个Tidy的配置
Tidy doc = new Tidy();
doc.Options.DocType = DocType.User;
doc.Options.Xhtml = true;
doc.Options.WrapScriptlets = true;
doc.Options.LogicalEmphasis = true;
doc.Options.DropFontTags = true;
doc.Options.DropEmptyParas = true;
doc.Options.QuoteAmpersand = true;
doc.Options.TidyMark = false;
doc.Options.MakeClean = true;
doc.Options.IndentContent = true;
doc.Options.SmartIndent = true;
doc.Options.Spaces = 0;
doc.Options.WrapLen = 0;
doc.Options.CharEncoding = CharEncoding.UTF8;
doc.Options.RawOut = true;
doc.Options.EncloseText = false;
然后改变
doc.Options.CharEncoding=CharEncoding.UTF8代码>
todoc.Options.CharEncoding=CharEncoding.Raw代码>但什么也没发生。您可以使用System.String类的Replace方法修复损坏的HTML我找到了一个解决方案
第371行Lexer.cs文件中的数字应为十六进制。
我把它改成
if (numeric && ((c == 'x') || (c == 'a') || (c == 'b') || (c == 'c') || (c == 'd') || (c == 'e') || (c == 'f') || (c == 'A') || (c == 'B') || (c == 'C') || (c == 'D') || (c == 'E') || (c == 'F')|| ((map & DIGIT) != 0)))
语法分析器可以正常工作。你能告诉我到目前为止你是如何尝试的吗?@parag meshram,我添加了详细信息有人知道如何将这些更改提交给Tidy.NET官方吗?