C# UTF8Encoding WindowsCodePage

Description

UTF8Encoding WindowsCodePage When overridden in a derived class, gets the Windows operating system code page that most closely corresponds to the current encoding.

Syntax

UTF8Encoding.WindowsCodePage has the following syntax.


public virtual int WindowsCodePage { get; }

Example


using System;//from   ww w  .  ja v a  2 s.  c o m
using System.Text;

public class SamplesEncoding  {
   public static void Main()  {
      foreach( EncodingInfo ei in Encoding.GetEncodings() )  {
         Encoding e = ei.GetEncoding();
         Console.WriteLine( "{0} {1,-25} ", ei.CodePage, ei.Name );
         Console.WriteLine( "{0} ", e.WindowsCodePage );

         if ( ei.CodePage != e.WindowsCodePage )
            Console.Write( "*" );
      }
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Text »




ASCIIEncoding
Encoding
EncodingInfo
StringBuilder
UnicodeEncoding
UTF8Encoding