According to https://github.com/dotnet/designs/blob/master/accepted/2020/better-obsoletion/obsoletions-in-net5.md, .NET 5 will obsolete the UTF-7 encoding:
The UTF-7 encoding is insecure and should not be used. Consider using UTF-8 instead.
I'm curious, is UTF-7 being used anywhere in PowerShell? I've certainly never come across it in the wild.
I'm curious, is UTF-7 being used anywhere in PowerShell? I've certainly never come across it in the wild.
It is exposed in public APIs such as Get-Content -Encoding UTF7
Yes, it is public and removing it will be a breaking change. But if .Net 5.0 will deprecate this we will have to do the same.
/cc @SteveL-MSFT @daxian-dbw It is for PowerShell Committee review.
Update: as an option we could keep UTF7 name but replace with UTF8 implementation.
@iSazonov System.Text.Encoding.UTF7 and System.Text.UTF7Encoding APIs are not being removed from .NET 5, they are being marked with ObsoleteAttribute. So we have a choice whether to remove the APIs or to suppress the warnings.
https://github.com/dotnet/designs/blob/master/accepted/2020/better-obsoletion/better-obsoletion.md
Search on GiHub https://github.com/search?l=PowerShell&q=UTF7&type=Code returns ~1K results. It is very small and it seems they simply replicate PowerShell support. I'd speculate that nobody uses UTF7 and we can remove it at all. The same for C#.
@PowerShell/powershell-committee discussed this, we have code that handles Encoding passed to cmdlets that accept that type for parameters. We agreed to add a warning message if the user specifies "UTF-7" as part of type conversion to warn the user that this encoding is obsolete, but we should not remove it while .NET itself still implements it even though obsolete.
See also: #13484
Related: #13430
:tada:This issue was addressed in #13484, which has now been successfully released as v7.1.0-preview.7.:tada:
Handy links:
Most helpful comment
@PowerShell/powershell-committee discussed this, we have code that handles
Encodingpassed to cmdlets that accept that type for parameters. We agreed to add a warning message if the user specifies "UTF-7" as part of type conversion to warn the user that this encoding is obsolete, but we should not remove it while .NET itself still implements it even though obsolete.