Redigera

Dela via


UnicodeEncodingConformance Enum

Definition

Controls how Unicode characters are output by the HtmlEncode methods.

public enum class UnicodeEncodingConformance
public enum UnicodeEncodingConformance
type UnicodeEncodingConformance = 
Public Enum UnicodeEncodingConformance
Inheritance
UnicodeEncodingConformance

Fields

Name Value Description
Auto 0

Use automatic behavior. The Unicode encoding behavior is determined by current application's target Framework. For .NET Framework 4.5 and later, the Unicode encoding behavior is strict.

Strict 1

Use strict behavior. Specifies that individual UTF-16 surrogate code points are combined into a single code point when one of the HtmlEncode methods is called. For example, given the input string "\uD84C\uDFB4" (or "\U000233B4"), the output of the HtmlEncode methods is "𣎴".

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.

Compat 2

Use compatible behavior. Specifies that individual UTF-16 surrogate code points are output as-is when one of HtmlEncode methods is called. For example, given a string "\uD84C\uDFB4" (or "\U000233B4"), the output of HtmlEncode is "\uD84C\uDFB4" (the input is not encoded).

Remarks

For more information on how Unicode characters are supposed to be encoded in HTML, see Using character escapes in markup and CSS.

Applies to

See also