-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Document new variable PSApplicationOutputEncoding #10876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jborean93
wants to merge
4
commits into
MicrosoftDocs:main
Choose a base branch
from
jborean93:PSApplicationOutputEncoding
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+171
−104
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||
| --- | ||||||
| description: Describes how PowerShell uses character encoding for input and output of string data. | ||||||
| Locale: en-US | ||||||
| ms.date: 03/09/2023 | ||||||
| ms.date: 12/03/2025 | ||||||
| online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_character_encoding?view=powershell-7.5&WT.mc_id=ps-gethelp | ||||||
| schema: 2.0.0 | ||||||
| title: about_Character_Encoding | ||||||
|
|
@@ -17,7 +17,7 @@ data. | |||||
|
|
||||||
| Unicode is a worldwide character-encoding standard. The system uses Unicode | ||||||
| exclusively for character and string manipulation. For a detailed description | ||||||
| of all aspects of Unicode, refer to [The Unicode Standard][01]. | ||||||
| of all aspects of Unicode, refer to [The Unicode Standard][07]. | ||||||
|
|
||||||
| Windows supports Unicode and traditional character sets. Traditional character | ||||||
| sets, such as Windows code pages, use 8-bit values or combinations of 8-bit | ||||||
|
|
@@ -91,7 +91,7 @@ In PowerShell 5.1, the **Encoding** parameter supports the following values: | |||||
| - `UTF7` Uses UTF-7. | ||||||
| - `UTF8` Uses UTF-8 (with BOM). | ||||||
|
|
||||||
| In general, Windows PowerShell uses the Unicode [UTF-16LE][03] encoding by | ||||||
| In general, Windows PowerShell uses the Unicode [UTF-16LE][06] encoding by | ||||||
| default. However, the default encoding used by cmdlets in Windows PowerShell | ||||||
| is not consistent. | ||||||
|
|
||||||
|
|
@@ -174,21 +174,22 @@ PowerShell defaults to `utf8NoBOM` for all output. | |||||
| Beginning with PowerShell 6.2, the **Encoding** parameter also allows numeric | ||||||
| IDs of registered code pages (like `-Encoding 1251`) or string names of | ||||||
| registered code pages (like `-Encoding "windows-1251"`). For more information, | ||||||
| see the .NET documentation for [Encoding.CodePage][04]. | ||||||
| see the .NET documentation for [Encoding.CodePage][08]. | ||||||
|
|
||||||
| Starting with PowerShell 7.4, you can use the `ANSI` value for the **Encoding** | ||||||
| parameter to pass the numeric ID for the current culture's ANSI code page | ||||||
| without having to specify it manually. | ||||||
|
|
||||||
| ## Changing the default encoding | ||||||
|
|
||||||
| PowerShell has two default variables that can be used to change the default | ||||||
| PowerShell has three default variables that can be used to change the default | ||||||
| encoding behavior. | ||||||
|
|
||||||
| - `$PSDefaultParameterValues` | ||||||
| - `$OutputEncoding` | ||||||
| - `$PSApplicationOutputEncoding` | ||||||
|
|
||||||
| For more information, see [about_Preference_Variables][05]. | ||||||
| For more information, see [about_Preference_Variables][04]. | ||||||
|
|
||||||
| Beginning in PowerShell 5.1, the redirection operators (`>` and `>>`) call the | ||||||
| `Out-File` cmdlet. Therefore, you can set the default encoding of them using | ||||||
|
|
@@ -207,31 +208,36 @@ $PSDefaultParameterValues['*:Encoding'] = 'utf8' | |||||
|
|
||||||
| > [!IMPORTANT] | ||||||
| > Putting this command in your PowerShell profile makes the preference a | ||||||
| > session-global setting that affects all commands and scripts that do not | ||||||
| > session-global setting that affects all commands and scripts that don't | ||||||
| > explicitly specify an encoding. | ||||||
| > | ||||||
| > Similarly, you should include such commands in your scripts or modules that | ||||||
| > you want to behave the same way. Using these commands ensure that cmdlets | ||||||
| > behave the same way even when run by another user, on a different computer, | ||||||
| > or in a different version of PowerShell. | ||||||
|
|
||||||
| The automatic variable `$OutputEncoding` affects the encoding PowerShell uses | ||||||
| to communicate with external programs. It has no effect on the encoding that | ||||||
| the output redirection operators and PowerShell cmdlets use to save to files. | ||||||
| The automatic variables `$OutputEncoding` affects the encoding PowerShell uses | ||||||
| to when sending data to external programs. The `$PSApplicationOutputEncoding` | ||||||
|
||||||
| to when sending data to external programs. The `$PSApplicationOutputEncoding` | |
| when sending data to external programs. The `$PSApplicationOutputEncoding` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.