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.​TextEncoder

Assembly: System.Text.Encodings.Web

Inheritance: object → TextEncoder

The base class of web encoders.

Properties

public int
MaxOutputCharactersPerInputCharacter
Gets the maximum number of characters that this encoder can generate for each input code point.

Methods

public void
Encode​(IO.​TextWriter output, char[] value, int startIndex, int characterCount)
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)
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)
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)
public string
Encode​(string value)
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)
public int
FindFirstCharacterToEncode​(Char* text, int textLength)
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)
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)
public bool
WillEncode​(int unicodeScalar)
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
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object