Default
The
Default
property returns the default encoding for the current
.NET installation.
PS C:> [System.Text.Encoding]::Default.EncodingName
Western European (Windows)
On
.NET Core , the default always returns a
System.Text.UTF8Encoding
class.
GetEncodings()
Encodings that were registered with RegisterProvider
(in System.Text.Encoding
) are not included in the returned list.
set-strictMode -version 2.0
$boolFlag = @{ $true = 'x'; $false = ' ' }
foreach ($info in [System.Text.Encoding]::GetEncodings()) {
$enc = $info.GetEncoding()
'{0,5} {1,-30} {2} {3}' -f
$info.CodePage,
$info.Name,
# $enc.BodyName, # BodyName seems to be always equal to Name
# $enc.HeaderName, # HeaderName seems to be always equal to Name
$boolFlag[$enc.IsBrowserDisplay],
$boolFlag[$enc.IsSingleByte ]
# $enc.WebName # WebName seems to be always equal to Name
}
With PowerShell 5.1, the script above might returrn something like
37 | IBM037 | | x |
437 | IBM437 | | x |
500 | IBM500 | | x |
708 | ASMO-708 | x | x |
720 | DOS-720 | x | x |
737 | ibm737 | | x |
775 | ibm775 | | x |
850 | ibm850 | | x |
852 | ibm852 | x | x |
855 | IBM855 | | x |
857 | ibm857 | | x |
858 | IBM00858 | | x |
860 | IBM860 | | x |
861 | ibm861 | | x |
862 | DOS-862 | x | x |
863 | IBM863 | | x |
864 | IBM864 | | x |
865 | IBM865 | | x |
866 | cp866 | x | x |
869 | ibm869 | | x |
870 | IBM870 | | x |
874 | windows-874 | x | x |
875 | cp875 | | x |
932 | shift_jis | x | |
936 | gb2312 | x | |
949 | ks_c_5601-1987 | x | |
950 | big5 | x | |
1026 | IBM1026 | | x |
1047 | IBM01047 | | x |
1140 | IBM01140 | | x |
1141 | IBM01141 | | x |
1142 | IBM01142 | | x |
1143 | IBM01143 | | x |
1144 | IBM01144 | | x |
1145 | IBM01145 | | x |
1146 | IBM01146 | | x |
1147 | IBM01147 | | x |
1148 | IBM01148 | | x |
1149 | IBM01149 | | x |
1200 | utf-16 | | |
1201 | utf-16BE | | |
1250 | windows-1250 | x | x |
1251 | windows-1251 | x | x |
1252 | Windows-1252 | x | x |
1253 | windows-1253 | x | x |
1254 | windows-1254 | x | x |
1255 | windows-1255 | x | x |
1256 | windows-1256 | x | x |
1257 | windows-1257 | x | x |
1258 | windows-1258 | x | x |
1361 | Johab | | |
10000 | macintosh | | x |
10001 | x-mac-japanese | | |
10002 | x-mac-chinesetrad | | |
10003 | x-mac-korean | | |
10004 | x-mac-arabic | | x |
10005 | x-mac-hebrew | | x |
10006 | x-mac-greek | | x |
10007 | x-mac-cyrillic | | x |
10008 | x-mac-chinesesimp | | |
10010 | x-mac-romanian | | x |
10017 | x-mac-ukrainian | | x |
10021 | x-mac-thai | | x |
10029 | x-mac-ce | | x |
10079 | x-mac-icelandic | | x |
10081 | x-mac-turkish | | x |
10082 | x-mac-croatian | | x |
12000 | utf-32 | | |
12001 | utf-32BE | | |
20000 | x-Chinese-CNS | | |
20001 | x-cp20001 | | |
20002 | x-Chinese-Eten | | |
20003 | x-cp20003 | | |
20004 | x-cp20004 | | |
20005 | x-cp20005 | | |
20105 | x-IA5 | | x |
20106 | x-IA5-German | | x |
20107 | x-IA5-Swedish | | x |
20108 | x-IA5-Norwegian | | x |
20127 | us-ascii | | x |
20261 | x-cp20261 | | |
20269 | x-cp20269 | | x |
20273 | IBM273 | | x |
20277 | IBM277 | | x |
20278 | IBM278 | | x |
20280 | IBM280 | | x |
20284 | IBM284 | | x |
20285 | IBM285 | | x |
20290 | IBM290 | | x |
20297 | IBM297 | | x |
20420 | IBM420 | | x |
20423 | IBM423 | | x |
20424 | IBM424 | | x |
20833 | x-EBCDIC-KoreanExtended | | x |
20838 | IBM-Thai | | x |
20866 | koi8-r | x | x |
20871 | IBM871 | | x |
20880 | IBM880 | | x |
20905 | IBM905 | | x |
20924 | IBM00924 | | x |
20932 | EUC-JP | | |
20936 | x-cp20936 | | |
20949 | x-cp20949 | | |
21025 | cp1025 | | x |
21866 | koi8-u | x | x |
28591 | iso-8859-1 | x | x |
28592 | iso-8859-2 | x | x |
28593 | iso-8859-3 | | x |
28594 | iso-8859-4 | x | x |
28595 | iso-8859-5 | x | x |
28596 | iso-8859-6 | x | x |
28597 | iso-8859-7 | x | x |
28598 | iso-8859-8 | x | x |
28599 | iso-8859-9 | x | x |
28603 | iso-8859-13 | | x |
28605 | iso-8859-15 | | x |
29001 | x-Europa | | x |
38598 | iso-8859-8-i | x | x |
50220 | iso-2022-jp | | |
50221 | csISO2022JP | | |
50222 | iso-2022-jp | | |
50225 | iso-2022-kr | | |
50227 | x-cp50227 | | |
51932 | euc-jp | x | |
51936 | EUC-CN | | |
51949 | euc-kr | | |
52936 | hz-gb-2312 | x | |
54936 | GB18030 | x | |
57002 | x-iscii-de | | |
57003 | x-iscii-be | | |
57004 | x-iscii-ta | | |
57005 | x-iscii-te | | |
57006 | x-iscii-as | | |
57007 | x-iscii-or | | |
57008 | x-iscii-ka | | |
57009 | x-iscii-ma | | |
57010 | x-iscii-gu | | |
57011 | x-iscii-pa | | |
65000 | utf-7 | | |
65001 | utf-8 | x | |
With PowerShell 7, the result set, on my machine, is much smaller.