NUglify icon indicating copy to clipboard operation
NUglify copied to clipboard

HtmlToText results in empty string

Open alexaka1 opened this issue 2 years ago • 3 comments

Describe the bug This html results in an empty string. Am I missing something? (.Net 7)

var html = """<h1><font face="Arial">Hello this is a page.</font></h1><p><font face="Arial" size="4"><br></font></p><h1><font face="Arial" size="4">C&#237;m</font></h1><p><font face="Arial" size="4"><br></font></p><p><font face="Arial" size="4">Bekezd&#233;s</font></p>""";
var result = Uglify.HtmlToText(html, HtmlToTextOptions.None, null).Code;
Assert.Equal("", result); // this is true, should be false in my opinion

result.Errors is empty. Excepted output code Something like Hello this is a page. Cím Bekezdés

The html is generated by a user via a WYSIWYG editor.

alexaka1 avatar Mar 09 '23 08:03 alexaka1

This needs some investigation

Current workaround is to add <body></body> around your html fragment

trullock avatar Mar 09 '23 14:03 trullock

+1 for same issue:

Uglify.HtmlToText("<h1>test</h1>")

returns empty Code

EdiWang avatar Apr 19 '24 05:04 EdiWang

Pull requests welcome

trullock avatar Apr 20 '24 11:04 trullock