Skip to content

Commit

Permalink
Add note about UrlEncode
Browse files Browse the repository at this point in the history
  • Loading branch information
ManickaP committed Oct 7, 2024
1 parent 8022d8a commit 11eb380
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions xml/System.Net/WebUtility.xml
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,9 @@
Each ' ' (space) character is converted to a `+` (plus) character.
> [!NOTE]
> Replacing ' ' (space) with a '+' (plus) sign is expected only in query part of URI (by convention, not by standard) or in [`application/x-www-form-urlencoded`](https://url.spec.whatwg.org/#percent-encoded-bytes) HTTP content. Moreover, the above mentioned list of characters that are **not** replaced does not correspond neither to [URL specification](https://url.spec.whatwg.org) nor URI [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986.html#section-3.4). Use <xref:System.Uri.WebUtility.EscapeDataString%2A> for RFC compliant transformation.
For example, when embedded in a block of text to be transmitted in a URL, the characters `<` and `>` are encoded as `%3c` and `%3e`.
The <xref:System.Net.WebUtility.UrlDecode%2A> method reverses the encoding.
Expand Down Expand Up @@ -636,6 +639,11 @@
- `(` and `)` (opening and closing parentheses)
Each ' ' (space) character is converted to a `+` (plus) character.
> [!NOTE]
> Replacing ' ' (space) with a '+' (plus) sign is expected only in query part of URI (by convention, not by standard) or in [`application/x-www-form-urlencoded`](https://url.spec.whatwg.org/#percent-encoded-bytes) HTTP content. Moreover, the above mentioned list of characters that are **not** replaced does not correspond neither to [URL specification](https://url.spec.whatwg.org) nor URI [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986.html#section-3.4). Use <xref:System.Uri.WebUtility.EscapeDataString%2A> for RFC compliant transformation.
For example, when embedded in a block of text to be transmitted in a URL, the characters `<` and `>` are encoded as `%3c` and `%3e`.
The <xref:System.Net.WebUtility.UrlDecodeToBytes%2A> method reverses the encoding.
Expand Down

0 comments on commit 11eb380

Please sign in to comment.