<PackageReference Include="System.Text.Encodings.Web" Version="9.0.1" />

HtmlEncoder

public abstract class HtmlEncoder : TextEncoder
Represents an HTML character encoding.
public static HtmlEncoder Default { get; }

Gets a built-in instance of the HtmlEncoder class.

protected HtmlEncoder()

Initializes a new instance of the HtmlEncoder class.

public static HtmlEncoder Create(TextEncoderSettings settings)

Creates a new instance of the HtmlEncoder class with the specified settings.

public static HtmlEncoder Create(UnicodeRange[] allowedRanges)

Creates a new instance of the HtmlEncoder class that specifies characters the encoder is allowed to not encode.