UnicodeEncodingConformance 列舉

定義

控制 HtmlEncode 方法輸出 Unicode 字元的方式。Controls how Unicode characters are output by the HtmlEncode methods.

public enum class UnicodeEncodingConformance
public enum UnicodeEncodingConformance
type UnicodeEncodingConformance = 
Public Enum UnicodeEncodingConformance
繼承
UnicodeEncodingConformance

欄位

Auto 0

使用自動行為。Use automatic behavior. Unicode 編碼行為取決於目前應用程式的目標 Framework。The Unicode encoding behavior is determined by current application's target Framework. 對於 .NET Framework 4.5.NET Framework 4.5 (含) 以後版本,採用嚴謹的 Unicode 編碼行為。For .NET Framework 4.5.NET Framework 4.5 and later, the Unicode encoding behavior is strict.

Compat 2

使用相容行為。Use compatible behavior. 指定當呼叫其中一個 HtmlEncode 方法時,依原狀輸出個別 UTF-16 Surrogate 字碼指標。Specifies that individual UTF-16 surrogate code points are output as-is when one of HtmlEncode methods is called. 例如,指定字串 "\uD84C\uDFB4" (或 "\U000233B4") 時,HtmlEncode 的輸出為 "\uD84C\uDFB4" (未對輸入進行編碼)。For example, given a string "\uD84C\uDFB4" (or "\U000233B4"), the output of HtmlEncode is "\uD84C\uDFB4" (the input is not encoded).

Strict 1

使用嚴謹行為。Use strict behavior. 指定當呼叫其中一個 HtmlEncode 方法時,將個別 UTF-16 Surrogate 字碼指標合併成單一字碼指標。Specifies that individual UTF-16 surrogate code points are combined into a single code point when one of the HtmlEncode methods is called. 例如,指定輸入字串 "\uD84C\uDFB4" (或 "\U000233B4") 時,HtmlEncode 方法的輸出為 "𣎴"。For example, given the input string "\uD84C\uDFB4" (or "\U000233B4"), the output of the HtmlEncode methods is "𣎴".

如果輸入是格式不正確的 UTF-16 字串 (例如其包含不成對的 Surrogates),則會在進行 HTML 編碼之前,將錯誤的字碼指標取代為 U+FFFD (Unicode 取代字元)。If the input is a malformed UTF-16 string (it contains unpaired surrogates, for example), the bad code points will be replaced with U+FFFD (Unicode replacement char) before being HTML-encoded.

備註

如需 Unicode 字元如何以 HTML 編碼的詳細資訊,請參閱在標記和 CSS 中使用字元轉義For more information on how Unicode characters are supposed to be encoded in HTML, see Using character escapes in markup and CSS.

適用於

另請參閱