C# Encoding GetEncoding(String)

Description

Encoding GetEncoding(String) Returns the encoding associated with the specified code page name.

Syntax

Encoding.GetEncoding(String) has the following syntax.


public static Encoding GetEncoding(
  string name
)

Parameters

Encoding.GetEncoding(String) has the following parameters.

  • name - The code page name of the preferred encoding. Any value returned by the WebName property is valid. Possible values are listed in the Name column of the table that appears in the Encoding class topic.

Returns

Encoding.GetEncoding(String) method returns The encoding associated with the specified code page.

Example


using System;/*  www .j a v  a 2 s. co m*/
using System.Text;

public class SamplesEncoding  {

   public static void Main()  {
      Encoding e1 = Encoding.GetEncoding( 12000 );
      Encoding e2 = Encoding.GetEncoding( "utf-32" );
      Console.WriteLine(e1.Equals( e2 ) );

   }

}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Text »




ASCIIEncoding
Encoding
EncodingInfo
StringBuilder
UnicodeEncoding
UTF8Encoding