Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# .NET和html实体_C#_.net_Html Entities_Tidy - Fatal编程技术网

C# .NET和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.

当我试图用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.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

to
doc.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官方吗?