BasicHttpBinding.TextEncoding Property

Gets or sets the character encoding that is used for the message text.

Namespace:  System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public Encoding TextEncoding { get; set; }

Property Value

Type: System.Text.Encoding
The Encoding that indicates the character encoding that is used. The default is UTF8Encoding.

            //Gets the character encoding for the binding
            Encoding encoding = binding.TextEncoding;
            //Output txtEncoding: System.Text.UTF8Encoding
            string txtEncoding = encoding.ToString();
            Encoding unicodeEncoding = new UnicodeEncoding();
            //Set a Unicode encoding for the binding
            binding.TextEncoding = unicodeEncoding;
            //Output txtEncoding: System.Text.UnicodeEncoding
            string txtUEncoding = binding.TextEncoding.ToString();


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions