Skip to content

Commit 61db0af

Browse files
authored
Simplify types and enums in default encoding RFC
Changes: * Change to `Microsoft.PowerShell.Encoding` * Change `Legacy` to `WindowsLegacy`
1 parent b679efc commit 61db0af

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

1-Draft/RFC0020-DefaultFileEncoding.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ If the BOM could be written when the platform expects it, interaction with nativ
4040

4141
## Specification
4242

43-
A new global variable `$PSDefaultFileEncoding` shall be available which allows the user to define the encoding for their system.
44-
The allowed values for this variable shall be defined by the `Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding` enum, with the following additions:
43+
A new global variable `$PSDefaultEncoding` shall be available which allows the user to define the encoding for their system.
44+
The allowed values for this variable shall be defined by the `Microsoft.PowerShell.Encoding` enum, with the following additions:
4545

4646
* UTF8NoBOM
47-
* Legacy
47+
* WindowsLegacy
4848

4949
The following is the complete list of `FileSystemCmdletProviderEncoding` members:
5050
* Ascii
@@ -62,9 +62,9 @@ The following is the complete list of `FileSystemCmdletProviderEncoding` members
6262
* UTF8
6363
* UTF8NoBOM
6464

65-
When `$PSDefaultFileEncoding` is set to `UTF8NoBOM`, the file shall be created with UTF8 encoding and no BOM shall be written.
65+
When `$PSDefaultEncoding` is set to `UTF8NoBOM`, the file shall be created with UTF8 encoding and no BOM shall be written.
6666

67-
When `$PSDefaultFileEncoding` is set to `Legacy`, the behavior shall be:
67+
When `$PSDefaultEncoding` is set to `Legacy`, the behavior shall be:
6868

6969
```
7070
CmdletName Encoding
@@ -80,8 +80,8 @@ Redirection UTF16
8080
```
8181
This persists the irregular file encoding on non-Windows platforms, and allows Linux files to be used on Windows with the same encoding as exists in previous releases of PowerShell.
8282

83-
The default on all platforms shall be `UTF8NOBOM` (including when `$PSDefaultFileEncoding` is not set).
84-
Naturally, specific use of the `-Encoding` parameter when invoking the cmdlet shall override `$PSDefaultFileEncoding`.
83+
The default on all platforms shall be `UTF8NOBOM` (including when `$PSDefaultEncoding` is not set).
84+
Naturally, specific use of the `-Encoding` parameter when invoking the cmdlet shall override `$PSDefaultEncoding`.
8585

8686
### Exclusions
8787

@@ -91,7 +91,7 @@ Remoting protocol cmdlets shall also be unaffected with this change.
9191

9292
### Optional
9393

94-
We should take this opportunity to rationalize our use of the `Encoding` parameter, and change the cmdlets which use Encoding as `string` or `System.Text.Encoding` type to use `Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding`.
94+
We should take this opportunity to rationalize our use of the `Encoding` parameter, and change the cmdlets which use Encoding as `string` or `System.Text.Encoding` type to use `Microsoft.PowerShell.Encoding`.
9595
The following cmdlets use various types for the parameter `Encoding`
9696

9797
```PowerShell
@@ -170,7 +170,7 @@ PS> "ĝoo" |out-file -encoding UTF8NoBOM file.txt
170170

171171
### Commentary
172172

173-
`UTF8NoBOM` and `Legacy` are, of course, not actual encodings but neither are a number of the other values for `FileSystemCmdletProviderEncoding`.
173+
`UTF8NoBOM` and `WindowsLegacy` are, of course, not actual encodings but neither are a number of the other values for `Microsoft.PowerShell.Encoding`.
174174
However, it is somewhat descriptive of our behavior.
175175

176176
### Alternate Approaches

0 commit comments

Comments
 (0)