Skip to content

Commit 0c7b82c

Browse files
committed
Alter spec to ensure that Legacy encoding is applicable to all platforms
1 parent 6ea6aab commit 0c7b82c

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

1-Draft/DefaultFileEncoding.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ The following is the complete list of `FileSystemCmdletProviderEncoding` members
6262
* UTF8
6363
* UTF8NoBOM
6464

65-
When `$PSDefaultFileEncoding` is set to `UTF8NoBOM`, the file will be created with UTF8 encoding but a BOM will not be added.
65+
When `$PSDefaultFileEncoding` 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 will change based on the platform:
67+
When `$PSDefaultFileEncoding` is set to `Legacy`, the behavior shall be:
6868

69-
**Windows**
7069
```
7170
CmdletName Encoding
7271
---------- --------
@@ -78,25 +77,17 @@ Set-Content ASCII
7877
Export-PSSession UTF8 (with BOM)
7978
Redirection UTF16
8079
```
80+
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.
8181

82-
**Non-Windows**
83-
```
84-
CmdletName Encoding
85-
---------- --------
86-
Add-Content UTF8 (no BOM)
87-
Export-Clixml UTF8 (no BOM)
88-
Export-CSV UTF8 (no BOM)
89-
Out-File UTF8 (no BOM)
90-
Set-Content UTF8 (no BOM)
91-
Export-PSSession UTF8 (no BOM)
92-
Redirection UTF8 (no BOM)
93-
```
9482
The default on Windows systems shall remain unchanged (the value for `$PSDefaultFileEncoding` shall be set to `Legacy`), non-Windows platforms shall set `$PSDefaultFileEncoding` to `UTF8NoBOM`.
95-
If the `$PSDefaultFileEncoding` is not set, `UTF8NoBOM` shall be the default for non-Windows systems, and the current behavior (`Legacy`) on Windows.
83+
If the `$PSDefaultFileEncoding` is not set, `UTF8NoBOM` shall be the default for non-Windows systems, and `Legacy` (the current behavior) on Windows.
84+
85+
Naturally, specific use of the `-encoding` parameter when invoking the cmdlet shall override `$PSDefaultFileEncoding`.
9686

9787
### Exclusions
9888

9989
Cmdlets which do not create a file are excluded from this change, so the `*-WebRequest` and `*-RestMethod` cmdlets shall not be changed.
90+
Only those cmdlets listed in the table above are to be changed, any other cmdlet which create files with a specific encoding are out of scope.
10091
Remoting protocol cmdlets shall also be unaffected with this change.
10192

10293
### Optional

0 commit comments

Comments
 (0)