C# Class Tp.Utils.Html.Encoder

White-list principle HTML entity encoder.
Unlike HttpUtility, provides stronger and more secure encoding where all characters except English alphabet letters will be encoded as HTML entities.
显示文件 Open project: TargetProcess/Target-Process-Plugins

Public Methods

Method Description
HtmlAttributeEncode ( string input ) : string

Encodes the specified input string for use in HTML tag attributes.

HtmlAttributeEncode ( TextReader input, TextWriter output ) : void

Encodes the specified input string for use in HTML tag attributes.

HtmlAttributeEncode ( string input, TextWriter output ) : void

Encodes the specified input string for use in HTML tag attributes.

HtmlEncode ( this input ) : string

Encodes the specified input string for use in HTML.

This method is null safe.

HtmlEncode ( TextReader input, TextWriter output ) : void

Reads text from the specified input and writes encoded text for use in HTML to the specified output.

HtmlEncode ( string input, TextWriter output ) : void

Encodes the specified input and writes encoded text for use in HTML to the specified output.

Private Methods

Method Description
HtmlAttributeEncode ( int ch, TextWriter output ) : void
HtmlEncode ( int ch, StringBuilder builder ) : void

Method Details

HtmlAttributeEncode() public static method

Encodes the specified input string for use in HTML tag attributes.
public static HtmlAttributeEncode ( string input ) : string
input string /// The string to encode, may be null. ///
return string

HtmlAttributeEncode() public static method

Encodes the specified input string for use in HTML tag attributes.
/// If is null. /// /// If is null. ///
public static HtmlAttributeEncode ( TextReader input, TextWriter output ) : void
input TextReader /// Input stream containing text to encode. ///
output System.IO.TextWriter /// Output stream where to write encoded text. ///
return void

HtmlAttributeEncode() public static method

Encodes the specified input string for use in HTML tag attributes.
/// If is null. ///
public static HtmlAttributeEncode ( string input, TextWriter output ) : void
input string /// The string to encode, may be null. ///
output System.IO.TextWriter /// Output stream where to write encoded text. ///
return void

HtmlEncode() public static method

Encodes the specified input string for use in HTML.
This method is null safe.
public static HtmlEncode ( this input ) : string
input this /// The string to encode, may be null. ///
return string

HtmlEncode() public static method

Reads text from the specified input and writes encoded text for use in HTML to the specified output.
/// If is null. /// /// If is null. ///
public static HtmlEncode ( TextReader input, TextWriter output ) : void
input TextReader /// Input stream containing text to encode. ///
output System.IO.TextWriter /// Output stream where to write encoded text. ///
return void

HtmlEncode() public static method

Encodes the specified input and writes encoded text for use in HTML to the specified output.
/// If is null. ///
public static HtmlEncode ( string input, TextWriter output ) : void
input string /// The text to encode, may be null. ///
output System.IO.TextWriter /// Output stream where to write encoded text. ///
return void