HtmlEncoder 类

定义

表示 HTML 字符编码。Represents an HTML character encoding.

public ref class HtmlEncoder abstract : System::Text::Encodings::Web::TextEncoder
public abstract class HtmlEncoder : System.Text.Encodings.Web.TextEncoder
type HtmlEncoder = class
    inherit TextEncoder
Public MustInherit Class HtmlEncoder
Inherits TextEncoder
继承
HtmlEncoder
派生

注解

此类型的源代码在 GitHub 上的 "system.web" 项目 中提供。The source code for this type is available in the System.Text.Encodings.Web project on GitHub. 也可以作为代码示例的单元测试可在 GitHub 上的 " system.web/测试 " 文件夹中找到。Unit tests that can also serve as code examples are found in the System.Text.Encodings.Web/tests folder on GitHub.

构造函数

HtmlEncoder()

初始化 HtmlEncoder 类的新实例。Initializes a new instance of the HtmlEncoder class.

属性

Default

获取 HtmlEncoder 类的内置实例。Gets a built-in instance of the HtmlEncoder class.

MaxOutputCharactersPerInputCharacter

获取此编码器可为每个输入码位生成的最大字符数。Gets the maximum number of characters that this encoder can generate for each input code point.

(继承自 TextEncoder)

方法

Create(TextEncoderSettings)

使用指定的设置创建 HtmlEncoder 类的新实例。Creates a new instance of the HtmlEncoder class with the specified settings.

Create(UnicodeRange[])

创建 HtmlEncoder 类的新实例,指定允许编码器不对其进行编码的字符。Creates a new instance of the HtmlEncoder class that specifies characters the encoder is allowed to not encode.

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

对提供的字符进行编码。Encodes the supplied characters.

(继承自 TextEncoder)
Encode(String)

编码所提供的字符串,并返回编码后的文本作为新字符串。Encodes the supplied string and returns the encoded text as a new string.

(继承自 TextEncoder)
Encode(TextWriter, Char[], Int32, Int32)

对数组中的字符进行编码,并将其写入 TextWriter 对象。Encodes characters from an array and writes them to a TextWriter object.

(继承自 TextEncoder)
Encode(TextWriter, String)

将指定的字符串编码为 TextWriter 对象。Encodes the specified string to a TextWriter object.

(继承自 TextEncoder)
Encode(TextWriter, String, Int32, Int32)

对子字符串进行编码,并将其写入 TextWriter 对象。Encodes a substring and writes it to a TextWriter object.

(继承自 TextEncoder)
EncodeUtf8(ReadOnlySpan<Byte>, Span<Byte>, Int32, Int32, Boolean)

对提供的 UTF-8 文本进行编码。Encodes the supplied UTF-8 text.

(继承自 TextEncoder)
Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
FindFirstCharacterToEncode(Char*, Int32)

查找要编码的第一个字符的索引。Finds the index of the first character to encode.

(继承自 TextEncoder)
FindFirstCharacterToEncodeUtf8(ReadOnlySpan<Byte>)

查找 UTF-8 文本输入缓冲区中第一个要被当前编码器实例进行转义的元素。Finds the first element in a UTF-8 text input buffer that would be escaped by the current encoder instance.

(继承自 TextEncoder)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)
TryEncodeUnicodeScalar(Int32, Char*, Int32, Int32)

编码一个 Unicode 标量值并将其写入缓冲区。Encodes a Unicode scalar value and writes it to a buffer.

(继承自 TextEncoder)
WillEncode(Int32)

确定是否将对给定的 Unicode 标量值进行编码。Determines if a given Unicode scalar value will be encoded.

(继承自 TextEncoder)

适用于