-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Summary of the new feature / enhancement
This is a follow up to #19156
Other cmdlets use an "-Encoding" parameter, eg Get-Content. It would be nice if this was used for the default encoding character set when the character set is not present in the ContentType and the body is some form of string rather than binary. This would be better than treating certain MIME types as somehow special.
Proposed technical implementation details (optional)
The Invoke-WebRequest refers to a default character set but it is not clear how this is determined, and the behaviour is different between 7.3.3 and powershell-7.4.0-preview.1
The concept is to use the "-Encoding" parameter to specify the default character set if it is not present in the MIME type.
An example is "application/json" is technically a binary encoding so should not have the charset in the ContentType.
It would be better to use an explicit "-Encoding" parameter than maintain a list of special MIME types that need particular character set encodings.