You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-Draft/DefaultFileEncoding.md
+7-16Lines changed: 7 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,11 +62,10 @@ The following is the complete list of `FileSystemCmdletProviderEncoding` members
62
62
* UTF8
63
63
* UTF8NoBOM
64
64
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.
66
66
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:
68
68
69
-
**Windows**
70
69
```
71
70
CmdletName Encoding
72
71
---------- --------
@@ -78,25 +77,17 @@ Set-Content ASCII
78
77
Export-PSSession UTF8 (with BOM)
79
78
Redirection UTF16
80
79
```
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.
81
81
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
-
```
94
82
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`.
96
86
97
87
### Exclusions
98
88
99
89
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.
100
91
Remoting protocol cmdlets shall also be unaffected with this change.
0 commit comments