C# Encoding GetEncoding(Int32)
Description
Encoding GetEncoding(Int32)
Returns the encoding associated
with the specified code page identifier.
Syntax
Encoding.GetEncoding(Int32)
has the following syntax.
public static Encoding GetEncoding(
int codepage
)
Parameters
Encoding.GetEncoding(Int32)
has the following parameters.
codepage
- The code page identifier of the preferred encoding. Possible values are listed in the Code Page column of the table that appears in the Encoding class topic.codepage
- -or-codepage
- 0 (zero), to use the default encoding.
Returns
Encoding.GetEncoding(Int32)
method returns The encoding that is associated with the specified code page.
Example
The following example gets two instances of the same encoding, and checks their equality.
/*w ww . j av a 2s . com*/
using System;
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.