C# Class Ushahidi.Common.Net.HttpUtility

Provides methods for encoding and decoding URLs when processing Web requests. This class cannot be inherited.
显示文件 Open project: ushahidi/Ushahidi_WinMobile

Public Methods

Method Description
HtmlDecode ( string s ) : string

Minimally converts a string to an HTML-encoded string.

Minimally converts a string into an HTML-encoded string and sends the encoded string to a output stream.

Converts a string that has been HTML-encoded for HTTP transmission into a decoded string.

HtmlDecode ( string s, TextWriter output ) : void

Converts a string that has been HTML-encoded into a decoded string, and sends the decoded string to a output stream.

UrlDecode ( byte bytes, Encoding e ) : string

Converts a URL-encoded byte array into a decoded string using the specified decoding object.

UrlDecode ( byte bytes, int offset, int count, Encoding e ) : string

Converts a URL-encoded byte array into a decoded string using the specified encoding object, starting at the specified position in the array, and continuing for the specified number of bytes.

UrlDecode ( string str ) : string

Parses a query string into a using encoding.

Parses a query string into a using the specified .

Converts a string that has been encoded for transmission in a URL into a decoded string.

UrlDecode ( string str, Encoding e ) : string

Converts a URL-encoded string into a decoded string, using the specified encoding object.

UrlDecodeToBytes ( byte bytes ) : byte[]

Converts a URL-encoded array of bytes into a decoded array of bytes.

UrlDecodeToBytes ( byte bytes, int offset, int count ) : byte[]

Converts a URL-encoded array of bytes into a decoded array of bytes, starting at the specified position in the array and continuing for the specified number of bytes.

UrlDecodeToBytes ( string str ) : byte[]

Converts a URL-encoded string into a decoded array of bytes.

UrlDecodeToBytes ( string str, Encoding e ) : byte[]

Converts a URL-encoded string into a decoded array of bytes using the specified decoding object.

UrlEncode ( byte bytes ) : string

Converts a byte array into an encoded URL string.

UrlEncode ( byte bytes, int offset, int count ) : string

Converts a byte array into a URL-encoded string, starting at the specified position in the array and continuing for the specified number of bytes.

UrlEncode ( string str ) : string

Encodes a URL string.

UrlEncode ( string str, Encoding e ) : string

Encodes a URL string using the specified encoding object.

UrlEncodeToBytes ( byte bytes ) : byte[]

Converts an array of bytes into a URL-encoded array of bytes.

UrlEncodeToBytes ( byte bytes, int offset, int count ) : byte[]

Converts an array of bytes into a URL-encoded array of bytes, starting at the specified position in the array and continuing for the specified number of bytes.

UrlEncodeToBytes ( string str ) : byte[]

Converts a string into a URL-encoded array of bytes.

UrlEncodeToBytes ( string str, Encoding e ) : byte[]

Converts a string into a URL-encoded array of bytes using the specified encoding object.

UrlEncodeUnicode ( string str ) : string

Converts a string into a Unicode string.

UrlEncodeUnicodeToBytes ( string str ) : byte[]

Converts a Unicode string into an array of bytes.

UrlPathEncode ( string str ) : string

Encodes the path portion of a URL string for reliable HTTP transmission from the Web server to a client.

Private Methods

Method Description
ASCIIGetString ( byte bytes ) : string

Decodes all the bytes in the specified byte array into a string.

Replace the method "System.Text.Encoding.ASCII.GetString(byte[] bytes);" in .Net Framework.

HexToInt ( char h ) : int
IntToHex ( int n ) : char

Converts a string to an HTML-encoded string.

Converts a string into an HTML-encoded string, and returns the output as a stream of output.

IsNonAsciiByte ( byte b ) : bool
IsSafe ( char ch ) : bool
UrlDecodeBytesFromBytesInternal ( byte buf, int offset, int count ) : byte[]
UrlDecodeStringFromBytesInternal ( byte buf, int offset, int count, Encoding e ) : string
UrlDecodeStringFromStringInternal ( string s, Encoding e ) : string
UrlEncodeBytesToBytesInternal ( byte bytes, int offset, int count, bool alwaysCreateReturnValue ) : byte[]
UrlEncodeBytesToBytesInternalNonAscii ( byte bytes, int offset, int count, bool alwaysCreateReturnValue ) : byte[]
UrlEncodeNonAscii ( string str, Encoding e ) : string
UrlEncodeSpaces ( string str ) : string
UrlEncodeUnicodeStringToStringInternal ( string s, bool ignoreAscii ) : string

Method Details

HtmlDecode() public static method

Minimally converts a string to an HTML-encoded string. Minimally converts a string into an HTML-encoded string and sends the encoded string to a output stream. Converts a string that has been HTML-encoded for HTTP transmission into a decoded string.
public static HtmlDecode ( string s ) : string
s string The string to encode.
return string

HtmlDecode() public static method

Converts a string that has been HTML-encoded into a decoded string, and sends the decoded string to a output stream.
public static HtmlDecode ( string s, TextWriter output ) : void
s string The string to decode.
output System.IO.TextWriter A stream of output.
return void

UrlDecode() public static method

Converts a URL-encoded byte array into a decoded string using the specified decoding object.
public static UrlDecode ( byte bytes, Encoding e ) : string
bytes byte The array of bytes to decode.
e System.Text.Encoding The that specifies the decoding scheme.
return string

UrlDecode() public static method

Converts a URL-encoded byte array into a decoded string using the specified encoding object, starting at the specified position in the array, and continuing for the specified number of bytes.
public static UrlDecode ( byte bytes, int offset, int count, Encoding e ) : string
bytes byte The array of bytes to decode.
offset int The position in the byte to begin decoding.
count int The number of bytes to decode.
e System.Text.Encoding The object that specifies the decoding scheme.
return string

UrlDecode() public static method

Parses a query string into a using encoding. Parses a query string into a using the specified . Converts a string that has been encoded for transmission in a URL into a decoded string.
query is null. query is null.- or -encoding is null.
public static UrlDecode ( string str ) : string
str string The string to decode.
return string

UrlDecode() public static method

Converts a URL-encoded string into a decoded string, using the specified encoding object.
public static UrlDecode ( string str, Encoding e ) : string
str string The string to decode.
e System.Text.Encoding The that specifies the decoding scheme.
return string

UrlDecodeToBytes() public static method

Converts a URL-encoded array of bytes into a decoded array of bytes.
public static UrlDecodeToBytes ( byte bytes ) : byte[]
bytes byte The array of bytes to decode.
return byte[]

UrlDecodeToBytes() public static method

Converts a URL-encoded array of bytes into a decoded array of bytes, starting at the specified position in the array and continuing for the specified number of bytes.
public static UrlDecodeToBytes ( byte bytes, int offset, int count ) : byte[]
bytes byte The array of bytes to decode.
offset int The position in the byte array at which to begin decoding.
count int The number of bytes to decode.
return byte[]

UrlDecodeToBytes() public static method

Converts a URL-encoded string into a decoded array of bytes.
public static UrlDecodeToBytes ( string str ) : byte[]
str string The string to decode.
return byte[]

UrlDecodeToBytes() public static method

Converts a URL-encoded string into a decoded array of bytes using the specified decoding object.
public static UrlDecodeToBytes ( string str, Encoding e ) : byte[]
str string The string to decode.
e System.Text.Encoding The object that specifies the decoding scheme.
return byte[]

UrlEncode() public static method

Converts a byte array into an encoded URL string.
public static UrlEncode ( byte bytes ) : string
bytes byte The array of bytes to encode.
return string

UrlEncode() public static method

Converts a byte array into a URL-encoded string, starting at the specified position in the array and continuing for the specified number of bytes.
public static UrlEncode ( byte bytes, int offset, int count ) : string
bytes byte The array of bytes to encode.
offset int The position in the byte array at which to begin encoding.
count int The number of bytes to encode.
return string

UrlEncode() public static method

Encodes a URL string.
public static UrlEncode ( string str ) : string
str string The text to encode.
return string

UrlEncode() public static method

Encodes a URL string using the specified encoding object.
public static UrlEncode ( string str, Encoding e ) : string
str string The text to encode.
e System.Text.Encoding The object that specifies the encoding scheme.
return string

UrlEncodeToBytes() public static method

Converts an array of bytes into a URL-encoded array of bytes.
public static UrlEncodeToBytes ( byte bytes ) : byte[]
bytes byte The array of bytes to encode.
return byte[]

UrlEncodeToBytes() public static method

Converts an array of bytes into a URL-encoded array of bytes, starting at the specified position in the array and continuing for the specified number of bytes.
public static UrlEncodeToBytes ( byte bytes, int offset, int count ) : byte[]
bytes byte The array of bytes to encode.
offset int The position in the byte array at which to begin encoding.
count int The number of bytes to encode.
return byte[]

UrlEncodeToBytes() public static method

Converts a string into a URL-encoded array of bytes.
public static UrlEncodeToBytes ( string str ) : byte[]
str string The string to encode.
return byte[]

UrlEncodeToBytes() public static method

Converts a string into a URL-encoded array of bytes using the specified encoding object.
public static UrlEncodeToBytes ( string str, Encoding e ) : byte[]
str string The string to encode
e System.Text.Encoding The that specifies the encoding scheme.
return byte[]

UrlEncodeUnicode() public static method

Converts a string into a Unicode string.
public static UrlEncodeUnicode ( string str ) : string
str string The string to convert.
return string

UrlEncodeUnicodeToBytes() public static method

Converts a Unicode string into an array of bytes.
public static UrlEncodeUnicodeToBytes ( string str ) : byte[]
str string The string to convert.
return byte[]

UrlPathEncode() public static method

Encodes the path portion of a URL string for reliable HTTP transmission from the Web server to a client.
public static UrlPathEncode ( string str ) : string
str string The text to URL-encode.
return string