WebUtility.HtmlDecode 方法

定義

將 HTTP 傳輸的 HTTP 編碼字串轉換成已解碼的字串。Converts a string that has been HTML-encoded for HTTP transmission into a decoded string.

多載

HtmlDecode(String)

將 HTTP 傳輸的 HTTP 編碼字串轉換成已解碼的字串。Converts a string that has been HTML-encoded for HTTP transmission into a decoded string.

HtmlDecode(String, TextWriter)

將已 HTML 編碼的字串轉換成已解碼的字串,並將解碼的字串傳送至 TextWriter 輸出資料流。Converts a string that has been HTML-encoded into a decoded string, and sends the decoded string to a TextWriter output stream.

HtmlDecode(String)

將 HTTP 傳輸的 HTTP 編碼字串轉換成已解碼的字串。Converts a string that has been HTML-encoded for HTTP transmission into a decoded string.

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

要解碼的字串。The string to decode.

傳回

String

已解碼的字串。A decoded string.

備註

如果在 HTTP 資料流程中傳遞空白和標點符號之類的字元,它們可能會在接收端被誤解。If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. HTML 編碼會將 HTML 中不允許的字元轉換為對等的字元實體;HTML 解碼會反轉編碼。HTML encoding converts characters that are not allowed in HTML into character-entity equivalents; HTML decoding reverses the encoding. 例如,內嵌在文字區塊中時,字元 <> 會編碼為 &lt;&gt; HTTP 傳輸。For example, when embedded in a block of text, the characters < and > are encoded as &lt; and &gt; for HTTP transmission.

如果 value 參數為 null ,則傳回的已解碼字串為 nullIf the value parameter is null, then the returned decoded string is null. 如果 value 參數是空字串,則傳回的已解碼字串會是空字串。If the value parameter is an empty string, then the returned decoded string is an empty string.

另請參閱

適用於

HtmlDecode(String, TextWriter)

將已 HTML 編碼的字串轉換成已解碼的字串,並將解碼的字串傳送至 TextWriter 輸出資料流。Converts a string that has been HTML-encoded into a decoded string, and sends the decoded string to a TextWriter output stream.

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

要解碼的字串。The string to decode.

output
TextWriter

TextWriter 的輸出資料流。A TextWriter stream of output.

例外狀況

如果 output 參數不是 nullvalue 不能為 nullThe output parameter cannot be null if the value parameter is not null.

備註

如果在 HTTP 資料流程中傳遞空白和標點符號之類的字元,它們可能會在接收端被誤解。If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. HTML 編碼會將 HTML 中不允許的字元轉換為對等的字元實體;HTML 解碼會反轉編碼。HTML encoding converts characters that are not allowed in HTML into character-entity equivalents; HTML decoding reverses the encoding. 例如,內嵌在文字區塊中時,字元 <> 會編碼為 &lt;&gt; HTTP 傳輸。For example, when embedded in a block of text, the characters < and > are encoded as &lt; and &gt; for HTTP transmission.

另請參閱

適用於