You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See https://stackoverflow.com/a/40098904/738188 for details. The issue is that the default encoding for Export-Clixml is different on Windows PowerShell and PowerShell Core. In the former it's UTF16LE/BE and in PowerShell Core it's UTF8 w/o a BOM.
The default encodings are documented if you look at the PS-version specific doc page:
With many programs using PS and PS Core at the same time (in process consoles in VS Code, etc), it's highly likely that they'll step on each other.
Possible Solution
The solution should be to specify the -Encoding parameter on all uses of Export-Clixml and other commands that write files. That will prevent conflicting defaults.
Expected Behavior
The prefs.xml file should not be corrupt.
Current Behavior
See https://stackoverflow.com/a/40098904/738188 for details. The issue is that the default encoding for
Export-Clixml
is different on Windows PowerShell and PowerShell Core. In the former it's UTF16LE/BE and in PowerShell Core it's UTF8 w/o a BOM.The default encodings are documented if you look at the PS-version specific doc page:
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/export-clixml?view=powershell-7.4#-encoding shows
utf8NoBOM
as the default while https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/export-clixml?view=powershell-5.1#-encoding showsUnicode
as the default.With many programs using PS and PS Core at the same time (in process consoles in VS Code, etc), it's highly likely that they'll step on each other.
Possible Solution
The solution should be to specify the
-Encoding
parameter on all uses ofExport-Clixml
and other commands that write files. That will prevent conflicting defaults.Steps to Reproduce (for bugs)
prefs.xml.zip
Context
Frequent errors when launching a new terminal session from not being able to parse the prefs.
Your Environment
PS Core 7.4.6 and Windows PowerShell on Windows 11.
The text was updated successfully, but these errors were encountered: