Skip to content

Commit 11eb380

Browse files
committed
Add note about UrlEncode
1 parent 8022d8a commit 11eb380

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

xml/System.Net/WebUtility.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,9 @@
556556
557557
Each ' ' (space) character is converted to a `+` (plus) character.
558558
559+
> [!NOTE]
560+
> 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.
561+
559562
For example, when embedded in a block of text to be transmitted in a URL, the characters `<` and `>` are encoded as `%3c` and `%3e`.
560563
561564
The <xref:System.Net.WebUtility.UrlDecode%2A> method reverses the encoding.
@@ -636,6 +639,11 @@
636639
637640
- `(` and `)` (opening and closing parentheses)
638641
642+
Each ' ' (space) character is converted to a `+` (plus) character.
643+
644+
> [!NOTE]
645+
> 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.
646+
639647
For example, when embedded in a block of text to be transmitted in a URL, the characters `<` and `>` are encoded as `%3c` and `%3e`.
640648
641649
The <xref:System.Net.WebUtility.UrlDecodeToBytes%2A> method reverses the encoding.

0 commit comments

Comments
 (0)