UTF-8 Encoding (CHCP 65001) in PowerShell
- Unicode in PowerShell
-
Change System Locale to Use
UTF-8
Encoding in Windows PowerShell -
Set Encoding in
$PSDefaultParameterValues
Variable to UseUTF-8
Encoding in Windows PowerShell

This tutorial will teach you to use UTF-8
encoding in Windows PowerShell.
Unicode in PowerShell
Unicode is a worldwide character encoding standard. It defines how characters in text files, web pages, and other documents are represented.
The computer system uses Unicode to manipulate characters and strings. The default encoding in PowerShell is Windows-1252
.
Unicode was developed to support characters from all languages of the world. PowerShell supports a Unicode character encoding by default.
UTF-8
and UTF-16
are the most common Unicode encodings. PowerShell always uses BOM
in all Unicode encodings except UTF7
.
The BOM
(byte-order-mark) is a Unicode signature included at the first few bytes of a file or text stream that indicates the Unicode encoding.
Change System Locale to Use UTF-8
Encoding in Windows PowerShell
There is an option to change the system locale (current language for non-Unicode programs) in Windows. But this feature is still in beta.
Go to Region Settings
from the Control Panel
or open intl.cpl
from the Run
program.
Open the Administrative
tab and click Change system locale
. Then check the Beta option as shown in the image below.
After that, press OK
and restart the computer to apply the settings.
After restarting the computer, you can check the $OutputEncoding
variable to view the current encoding.
$OutputEncoding
Output:
As you can see, the current encoding is Unicode (UTF-8).
BodyName : utf-8
EncodingName : Unicode (UTF-8)
HeaderName : utf-8
WebName : utf-8
WindowsCodePage : 1200
IsBrowserDisplay : True
IsBrowserSave : True
IsMailNewsDisplay : True
IsMailNewsSave : True
IsSingleByte : False
EncoderFallback : System.Text.EncoderReplacementFallback
DecoderFallback : System.Text.DecoderReplacementFallback
IsReadOnly : True
CodePage : 65001
Now, you can view the characters of other languages in PowerShell.
Get-Content test.txt
Output:
만나서 반가워요
Set Encoding in $PSDefaultParameterValues
Variable to Use UTF-8
Encoding in Windows PowerShell
You can run the following command to activate the UTF-8
encoding in PowerShell.
$PSDefaultParameterValues = @{'*:Encoding' = 'utf8'}
It is only valid for the current PowerShell console. It will be reset to default after you exit the PowerShell window.
Get-Content test.txt
Output:
만나서 반가워요
Several cmdlets in PowerShell have the -Encoding
parameter to specify the encoding for different character sets. Some of them are Add-Content
, Set-Content
, Get-Content
, Export-Csv
, Out-File
, etc.
The -Encoding
parameter supports these values: ascii
, bigendianunicode
, oem
, unicode
, utf7
, utf8
,utf8BOM
, utf8NoBOM
, utf32
.
We hope this tutorial gave you an idea of using UTF-8 Encoding (CHCP 65001) in Windows PowerShell.