我想解码HTML或文本。我 - 附相同result-使用此功能:一次解码整个HTML实体
- HtmlEntity.DeEntitize
- HttpUtility.HtmlDecode
- WebUtility.HtmlDecode
例如,当我喜欢解码Martian's atmosphere
,我得到Martian's atmosphere
而不是。
,当我使用这个代码(EXP),一切都是正确的(字符解码):
TextBox1.Text = "Martian's atmosphere"
For i = 0 To 2
TextBox1.Text = WebUtility.HtmlDecode(TextBox1.Text)
i += 1
Next
问题是我不喜欢使用循环,因为有时我不得不解码完整的HTML页面或长文本。
谢谢。
所以你说你要贯穿HtmlDecode字符串前两次它的完全解码? – Dave
'HttpUtility.HtmlDecode'似乎工作:https://dotnetfiddle.net/CVJUxQ –
是的。我必须更多地运行HtmlDecode。如果一个单词有3个编码实体,我必须运行3次HtmlDecode。 – Tajrib