Encoding::UTF8 Property
Updated: October 2010
Gets an encoding for the UTF-8 format.
Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
This property returns a UTF8Encoding object that encodes Unicode characters into a sequence of one to four bytes per character, and that decodes a UTF-8-encoded byte array to Unicode characters. For information about the character encodings supported by the .NET Framework and a discussion of which Unicode encoding to use, see Understanding Encodings.
The UTF8Encoding object that is returned by this property may not have the appropriate behavior for your application. It uses replacement fallback to replace each string that it cannot encode and each byte that it cannot decode with a question mark ("?") character. Instead, you can call the UTF8Encoding::UTF8Encoding(Boolean, Boolean) constructor to instantiate a UTF8Encoding object whose fallback is either an EncoderFallbackException or a DecoderFallbackException, as the following example illustrates.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.