Created
January 30, 2013 07:54
-
-
Save xoner/4671514 to your computer and use it in GitHub Desktop.
Set the default en coding to UTF-8 in powershell. As seen in http://blogs.msdn.com/b/powershell/archive/2006/12/11/outputencoding-to-the-rescue.aspx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$OutputEncoding = New-Object -typename System.Text.UTF8Encoding | |
[Console]::OutputEncoding = New-Object -typename System.Text.UTF8Encoding |
Ended up using $PSDefaultParameterValues['*:Encoding'] = 'utf8'
to set utf-8 to "to change the default encoding for all cmdlets that have the Encoding parameter". Also put it in the $profile
file for persistence.
You can also add [Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8
to the start of your powershell profile script.
Notepad $profile
If the file doesn't exist, create one
add [Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8
as the first line of the file`
save
restart powershell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
worked for me for PowerShell 5.1, as per this doc