Skip to content

Document Unicode encoding behavior in Uri.GetLeftPart method #11479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions xml/System/Uri.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2442,6 +2442,12 @@ If you used an escaped string to construct this instance (for example, `"http://

The <xref:System.Uri.GetLeftPart%2A> method returns a string containing the leftmost portion of the URI string, ending with the portion specified by `part`.

> [!IMPORTANT]
> The <xref:System.Uri.GetLeftPart%2A> method performs Unicode character encoding and normalization as part of its processing. It is not a simple string manipulation method. The returned string may differ from the original URI string due to this encoding behavior.

The <xref:System.Uri.GetLeftPart%2A> method is equivalent to calling <xref:System.Uri.GetComponents%2A> with the appropriate <xref:System.UriComponents> flags. For example:
- `GetLeftPart(UriPartial.Authority)` is equivalent to `GetComponents(UriComponents.Scheme | UriComponents.UserInfo | UriComponents.Host | UriComponents.Port, UriFormat.UriEscaped)`

<xref:System.Uri.GetLeftPart%2A> includes delimiters in the following cases:

- <xref:System.UriPartial.Scheme> includes the scheme delimiter.
Expand Down
Loading