WebUtility.HtmlDecode 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将已经为 HTTP 传输进行过 HTML 编码的字符串转换为已解码的字符串。
重载
HtmlDecode(String) |
将已经为 HTTP 传输进行过 HTML 编码的字符串转换为已解码的字符串。 |
HtmlDecode(String, TextWriter) |
将已经过 HTML 编码的字符串转换为已解码的字符串并将其发送给 TextWriter 输出流。 |
HtmlDecode(String)
将已经为 HTTP 传输进行过 HTML 编码的字符串转换为已解码的字符串。
public:
static System::String ^ HtmlDecode(System::String ^ value);
public static string HtmlDecode (string value);
public static string? HtmlDecode (string? value);
static member HtmlDecode : string -> string
Public Shared Function HtmlDecode (value As String) As String
参数
- value
- String
要解码的字符串。
返回
已解码的字符串。
注解
如果在 HTTP 流中传递空白和标点符号等字符,则它们可能会在接收端被误解。 HTML 编码将 HTML 中不允许的字符转换为字符实体等效项;HTML 解码会反转编码。 例如,在文本块中嵌入时,字符 <
和 >
编码为 <
>
HTTP 传输。
value
如果参数为null
,则返回的解码字符串为 null
。 value
如果参数为空字符串,则返回的解码字符串为空字符串。
另请参阅
适用于
HtmlDecode(String, TextWriter)
将已经过 HTML 编码的字符串转换为已解码的字符串并将其发送给 TextWriter 输出流。
public:
static void HtmlDecode(System::String ^ value, System::IO::TextWriter ^ output);
public static void HtmlDecode (string? value, System.IO.TextWriter output);
public static void HtmlDecode (string value, System.IO.TextWriter output);
static member HtmlDecode : string * System.IO.TextWriter -> unit
Public Shared Sub HtmlDecode (value As String, output As TextWriter)
参数
- value
- String
要解码的字符串。
- output
- TextWriter
TextWriter 输出流。
例外
如果 output
参数不为 null
,则 value
参数不能为 null
。
注解
如果在 HTTP 流中传递空白和标点符号等字符,则它们可能会在接收端被误解。 HTML 编码将 HTML 中不允许的字符转换为字符实体等效项;HTML 解码会反转编码。 例如,在文本块中嵌入时,字符 <
和 >
编码为 <
>
HTTP 传输。