WebUtility.HtmlDecode 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將 HTTP 傳輸的 HTTP 編碼字串轉換成已解碼的字串。
多載
| HtmlDecode(String) |
將 HTTP 傳輸的 HTTP 編碼字串轉換成已解碼的字串。 |
| HtmlDecode(String, TextWriter) |
將已 HTML 編碼的字串轉換成已解碼的字串,並將解碼的字串傳送至 TextWriter 輸出資料流。 |
HtmlDecode(String)
將 HTTP 傳輸的 HTTP 編碼字串轉換成已解碼的字串。
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 傳輸。