The GetEncoding method relies on the foundation platform to support most code pages. However, the system support is provided for the following case: the default code, that is, the encoding specified in the area setting of the computer that performs this method; Little-Endian Unicode (UTF-16LE); BIG-Endian Unicode (UTF-16BE); Windows operating system (Windows-1252); UTF-7; UTF-8; ASCII and GB18030 (Simplified Chinese).
Specifies one of the names listed in the table below to obtain encoding supported by the system with the corresponding code page.
Code Page Name 1200 "UTF-16LE", "UTF-16", "UCS-2", "Unicode" or "ISO-10646-UCS-2" 1201 "UTF-16BE" or "Unicodeffe" 1252 "Windows-1252 "65000" UTF-7 "," CSUNICODE11UTF7 "," Unicode-1-1-UTF-7 "," Unicode-2-0-UTF-7 "," X-Unicode-1-1-UTF-7 "or "X-Unicode-2-0-UTF-7" 65001 "UTF-8", "Unicode-1-1-UTF-8", "Unicode-2-0-UTF-8", "X-Unicode-1 -1-UTF-8 "or" X-Unicode-2-0-UTF-8 "20127" US-ASCII "," US "," ASCII "," ANSI_X3.4-1968 "," ANSI_X3.4-1986 "," CP367 "," CSASCII "," IBM367 "," ISO-IR-6 "," ISO646-US "or" ISO_646.IRV: 1991 "54936" GB18030 "
Some platforms may not support specific code pages. For example, the US version of Windows 98 may not support Japanese Shift-JIS code page (code page 932). In this case, the GetEncoding method will trigger NotSupportedException when executing the following C # code:
Encoding enc = encoding.getencoding ("Shift-jis");