Export (0) Print
Expand All

UnicodeEncodingConformance Enumeration

.NET Framework 4.5

Controls how Unicode characters are output by the HtmlEncode methods.

Namespace:  System.Net.Configuration
Assembly:  System (in System.dll)

public enum UnicodeEncodingConformance

Member nameDescription
AutoUse 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.       
CompatUse 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).
StrictUse 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.

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

.NET Framework

Supported in: 4.6
Show:
© 2014 Microsoft