The powershell cmdlet out-file
has the switch -encoding
witch you can set to default
. This default value will use the encoding of the system's current ANSI code page.
My question is: How can I get the name of this default encoding that out-file
will use with powershell?
In Windows PowerShell, the default encoding is usually Windows-1252, an extension of latin-1, also known as ISO 8859-1.
In general, Windows PowerShell uses the Unicode UTF-16LE encoding by default. However, the default encoding used by cmdlets in Windows PowerShell is not consistent. Using any Unicode encoding, except UTF7 , always creates a BOM.
The default character encoding is assumed to be UTF-8 on Windows. So if the default operating system Locale is "English_USA. 1252" the default locale for Boost. Locale on Windows would be "en_US.
Take a look at [System.Text.Encoding]::Default
, I believe it is used as "default".
E.g. in my case:
[System.Text.Encoding]::Default.EncodingName
gets
Cyrillic (Windows)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With