Skip to content

Commit 216c332

Browse files
committed
Add note about UrlEncode
1 parent 8022d8a commit 216c332

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

xml/System.Net/WebUtility.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,9 +556,12 @@
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
561-
The <xref:System.Net.WebUtility.UrlDecode%2A> method reverses the encoding.
564+
The <xref:System.Net.WebUtility.UrlDecode> method reverses the encoding.
562565
563566
]]></format>
564567
</remarks>
@@ -636,9 +639,14 @@
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
641-
The <xref:System.Net.WebUtility.UrlDecodeToBytes%2A> method reverses the encoding.
649+
The <xref:System.Net.WebUtility.UrlDecodeToBytes> method reverses the encoding.
642650
643651
]]></format>
644652
</remarks>

0 commit comments

Comments
 (0)