Gets or sets the encoding the console uses to write output.
Assembly: mscorlib (in mscorlib.dll)
The console uses the output encoding to translate characters written by an application into corresponding console display characters. The default code page that the console uses is determined by the system locale.
Starting with the .NET Framework 4, a property get operation may return a cached value instead of the console's current output encoding. This can occur if the value of the property is modified by some means other than an assignment to the property, such as calling the Windows SetConsoleOutputCP function.Notes to Callers
Of the Unicode encodings, the Console class supports UTF-8 encoding with the UTF8Encoding class and, starting with the .NET Framework 4.5, it supports UTF-16 encoding with the UnicodeEncoding class. UTF-32 encoding with the UTF32Encoding class is not supported. Attempting to set the output encoding to UTF-32 throws an IOException.
Note that successfully displaying Unicode characters to the console requires the following:
The console must use a TrueType font, such as Lucida Console or Consolas, to display characters.
A font used by the console must define the particular glyph or glyphs to be displayed. The console can take advantage of font linking to display glyphs from linked fonts if the base font does not contain a definition for that glyph.
For more information about support for Unicode encoding by the console, see the "Unicode Support for the Console" section in the Console class.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.