-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Note: The following applies exclusively to Windows PowerShell (PowerShell Core now consistently uses UTF-8 encoding without BOM).
#1483 resulted in some updates and was closed, but the gist of the issue has not been addressed:
The Set-Content and Add-Content help topics still incorrectly claim that ASCII is the default character encoding - see linked issue for a demonstration that it is, in fact, ANSI (Default, the system's active ANSI code page).
Similarly, the Out-File and Export-CliXml topics claims ASCII, even though it has always been "Unicode" (UTF-16LE).
Export-PSSession creates UTF-8 files with BOM by default, even though the help topic claims ASCII.
New-ModuleManifest invariably creates UTF-16LE files - it doesn't support -Encoding, and there's currently no mention of what encoding is used.
New-Item -Type File -Value creates a UTF-8 file without BOM (which means that Get-Content would misinterpret it, for instance).
Import-Csv, Import-CliXml, and Select-String surprisingly default to UTF-8 when reading a file without BOM - unlike Get-Content and Import-PowerShellDataFile.
One aspect in particular - that Out-File -Append / >> ignore the encoding of existing content in the target file - is the subject of PowerShell/PowerShell#9423.
Version(s) of document impacted
- Impacts 6.next document
- Impacts 6 document
- Impacts 5.1 document
- Impacts 5.0 document
- Impacts 4.0 document
- Impacts 3.0 document
Reason(s) for not selecting all version of documents
- The documented feature was introduced in selected version of PowerShell
- This issue only shows up in selected version of the document