WebUtility.UrlEncodeToBytes(Byte[], Int32, Int32) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Converts a byte array into a URL-encoded byte array.
public:
static cli::array <System::Byte> ^ UrlEncodeToBytes(cli::array <System::Byte> ^ value, int offset, int count);
public static byte[] UrlEncodeToBytes (byte[] value, int offset, int count);
public static byte[]? UrlEncodeToBytes (byte[]? value, int offset, int count);
static member UrlEncodeToBytes : byte[] * int * int -> byte[]
Public Shared Function UrlEncodeToBytes (value As Byte(), offset As Integer, count As Integer) As Byte()
An encoded Byte array.
If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. URL encoding replaces characters that are not allowed in a URL with character-entity equivalents consisting of hexadecimal escape sequences. The converted string is expected to conform to the UTF-8 format.
URL encoding replaces all character codes except for letters, numbers, and the following punctuation characters:
-
(minus sign)_
(underscore).
(period)!
(exclamation point)*
(asterisk)'
(single quotation mark)(
and)
(opening and closing parentheses)
Each ' ' (space) character is converted to a +
(plus) character.
Megjegyzés
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
HTTP content. Moreover, the above mentioned list of characters that are not replaced does not correspond neither to URL specification nor URI RFC 3986. Use EscapeDataString 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 UrlDecodeToBytes method reverses the encoding.
Termék | Verziók |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |
.NET-visszajelzés
A(z) .NET egy nyílt forráskód projekt. Visszajelzés adásához válasszon egy hivatkozást: