URI paths with non-ASCII characters parse correctly on Unix

A bug was fixed in the System.Uri class such that absolute URI paths that contain non-ASCII characters now parse correctly on Unix platforms.

Change description

In previous versions of .NET, absolute URI paths that contain non-ASCII characters are parsed incorrectly on Unix platforms, and segments of the path are duplicated. (Absolute paths are those that start with "/".) The parsing issue has been fixed for .NET 5. If you move from a previous version of .NET to .NET 5 or later, you'll get different values produced by Uri.AbsoluteUri, Uri.ToString(), and other Uri members.

Consider the output of the following code when run on Unix.

var myUri = new Uri("/üri");

Console.WriteLine($"AbsoluteUri: {myUri.AbsoluteUri}");
Console.WriteLine($"ToString: {myUri.ToString()}");

Output on previous .NET version:

AbsoluteUri: /%C3%BCri/%C3%BCri
ToString: /üri/üri

Output on .NET 5 or later version:

AbsoluteUri: /%C3%BCri
ToString: /üri

Version introduced

5.0

If you have code that expects and accounts for the duplicated path segments, you can remove that code.

Affected APIs