Επεξεργασία

Κοινή χρήση μέσω


TextEncoder Class

Definition

The base class of web encoders.

public ref class TextEncoder abstract
public abstract class TextEncoder
type TextEncoder = class
Public MustInherit Class TextEncoder
Inheritance
TextEncoder
Derived

Remarks

TextEncoder subclasses can be used to do HTML encoding, URI encoding, and JavaScript encoding. Instances of such subclasses can be accessed using the HtmlEncoder.Default, UrlEncoder.Default, and JavaScriptEncoder.Default properties.

The source code for this type is available in the System.Text.Encodings.Web project on GitHub. Unit tests that can also serve as code examples are found in the System.Text.Encodings.Web/tests folder on GitHub.

Constructors

TextEncoder()

Initializes a new instance of the TextEncoder class.

Properties

MaxOutputCharactersPerInputCharacter

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

Methods

Encode(ReadOnlySpan<Char>, Span<Char>, Int32, Int32, Boolean)

Encodes the supplied characters.

Encode(String)

Encodes the supplied string and returns the encoded text as a new string.

Encode(TextWriter, Char[], Int32, Int32)

Encodes characters from an array and writes them to a TextWriter object.

Encode(TextWriter, String, Int32, Int32)

Encodes a substring and writes it to a TextWriter object.

Encode(TextWriter, String)

Encodes the specified string to a TextWriter object.

EncodeUtf8(ReadOnlySpan<Byte>, Span<Byte>, Int32, Int32, Boolean)

Encodes the supplied UTF-8 text.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
FindFirstCharacterToEncode(Char*, Int32)

Finds the index of the first character to encode.

FindFirstCharacterToEncodeUtf8(ReadOnlySpan<Byte>)

Finds the first element in a UTF-8 text input buffer that would be escaped by the current encoder instance.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
TryEncodeUnicodeScalar(Int32, Char*, Int32, Int32)

Encodes a Unicode scalar value and writes it to a buffer.

WillEncode(Int32)

Determines if a given Unicode scalar value will be encoded.

Applies to