【发布时间】:2021-02-17 00:17:38
【问题描述】:
我使用 xml 文件。 我从中得到一个字符串,这个字符串是在 html 中编码的; 我尝试使用 HttpUtility.HtmlDecode 但是,它不起作用...... 我错过了什么? Screen
【问题讨论】:
标签: c# htmldecode httputility
我使用 xml 文件。 我从中得到一个字符串,这个字符串是在 html 中编码的; 我尝试使用 HttpUtility.HtmlDecode 但是,它不起作用...... 我错过了什么? Screen
【问题讨论】:
标签: c# htmldecode httputility
nbsp; 是一个 invalid HTMLEncoded 实体,  是一个有效的 1,表示非中断空间。
例子
var aStr = @"<root> <children> <child1> This is <b>bold</b> </child1> <child2> This is nbsp; <b>bold</b> nbsp;nbsp; </child2></children> </root>";
var decoded = HttpUtility.HtmlDecode(aStr);
// decoded value "<root> <children> <child1> This is <b>bold</b> </child1> <child2> This is nbsp; <b>bold</b> nbsp;nbsp; </child2></children> </root>"
【讨论】: