Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Text.​Encodings.​Web.​UrlEncoder
Assembly: System.Text.Encodings.Web
Inheritance: object → TextEncoder → UrlEncoder
Represents a URL character encoding.
Properties
public static
UrlEncoder
Default
Gets a built-in instance of the <see cref="T:System.Text.Encodings.Web.UrlEncoder" /> class.
public
int
MaxOutputCharactersPerInputCharacter
Gets the maximum number of characters that this encoder can generate for each input code point.
Methods
public static
UrlEncoder
Create​(TextEncoderSettings settings)
Creates a new instance of UrlEncoder class with the specified settings.
Returns A new instance of the <see cref="T:System.Text.Encodings.Web.UrlEncoder" /> class.
settings
Settings that control how the <see cref="T:System.Text.Encodings.Web.UrlEncoder" /> instance encodes, primarily which characters to encode.
public static
UrlEncoder
Create​(Unicode.​UnicodeRange[] allowedRanges)
Creates a new instance of the UrlEncoder class that specifies characters the encoder is allowed to not encode.
Returns A new instance of the <see cref="T:System.Text.Encodings.Web.UrlEncoder" /> class.
allowedRanges
The set of characters that the encoder is allowed to not encode.
public
void
Encode​(IO.​TextWriter output,
char[] value,
int startIndex,
int characterCount)
Inherited from TextEncoder
Encodes characters from an array and writes them to a <see cref="T:System.IO.TextWriter" /> object.
output
The stream to which to write the encoded text.
value
The array of characters to encode.
startIndex
The array index of the first character to encode.
characterCount
The number of characters in the array to encode.
public
void
Encode​(IO.​TextWriter output,
string value)
Inherited from TextEncoder
Encodes the specified string to a <see cref="T:System.IO.TextWriter" /> object.
output
The stream to which to write the encoded text.
value
The string to encode.
public
void
Encode​(IO.​TextWriter output,
string value,
int startIndex,
int characterCount)
Inherited from TextEncoder
Encodes a substring and writes it to a <see cref="T:System.IO.TextWriter" /> object.
output
The stream to which to write the encoded text.
value
The string whose substring is to be encoded.
startIndex
The index where the substring starts.
characterCount
The number of characters in the substring.
Encode​(ReadOnlySpan<​char> source,
Span<​char> destination,
Int32& charsConsumed,
Int32& charsWritten,
bool isFinalBlock = true)
Inherited from TextEncoder
public
string
Encode​(string value)
Inherited from TextEncoder
Encodes the supplied string and returns the encoded text as a new string.
Returns The encoded string.
value
The string to encode.
EncodeUtf8​(ReadOnlySpan<​byte> utf8Source,
Span<​byte> utf8Destination,
Int32& bytesConsumed,
Int32& bytesWritten,
bool isFinalBlock = true)
Inherited from TextEncoder
public
int
FindFirstCharacterToEncode​(Char* text,
int textLength)
Inherited from TextEncoder
Finds the index of the first character to encode.
Returns The index of the first character to encode.
text
The text buffer to search.
textLength
The number of characters in <paramref name="text" /> .
public
int
FindFirstCharacterToEncodeUtf8​(ReadOnlySpan<​byte> utf8Text)
Inherited from TextEncoder
Finds the first element in a UTF-8 text input buffer that would be escaped by the current encoder instance.
Returns The index of the first element in <paramref name="utf8Text" /> that would be escaped by the current encoder instance, or -1 if no data in <paramref name="utf8Text" /> requires escaping.
utf8Text
The UTF-8 text input buffer to search.
public
bool
TryEncodeUnicodeScalar​(int unicodeScalar,
Char* buffer,
int bufferLength,
Int32& numberOfCharactersWritten)
Inherited from TextEncoder
public
bool
WillEncode​(int unicodeScalar)
Inherited from TextEncoder
Determines if a given Unicode scalar value will be encoded.
Returns <see langword="true" /> if the <paramref name="unicodeScalar" /> value will be encoded by this encoder; otherwise, returns <see langword="false" /> .
unicodeScalar
A Unicode scalar value.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object