EscapeUtils Class Reference

#include <escapeutils.h>

Link against: inetprotutil.lib

class EscapeUtils
Public Member Enumerations
enumTEscapeMode { EEscapeNormal, EEscapeQuery, EEscapePath, EEscapeAuth, EEscapeUrlEncoded }
Public Member Functions
IMPORT_C HBufC8 *ConvertFromUnicodeToUtf8L(const TDesC &)
IMPORT_C HBufC *ConvertToUnicodeFromUtf8L(const TDesC8 &)
IMPORT_C HBufC8 *EscapeDecodeL(const TDesC8 &)
IMPORT_C HBufC16 *EscapeDecodeL(const TDesC16 &)
IMPORT_C HBufC8 *EscapeEncodeL(const TDesC8 &, TEscapeMode)
IMPORT_C HBufC16 *EscapeEncodeL(const TDesC16 &, TEscapeMode)
IMPORT_C HBufC8 *EscapeEncodeL(const TDesC8 &, const TDesC8 &)
IMPORT_C HBufC16 *EscapeEncodeL(const TDesC16 &, const TDesC16 &)
IMPORT_C TBoolIsEscapeTriple(const TDesC8 &, TInt &)
IMPORT_C TBoolIsEscapeTriple(const TDesC16 &, TInt &)
IMPORT_C TBoolIsExcludedChar(TChar)
HBufC8 *ReEscapeEncodeL(const TDesC8 &)
IMPORT_C HBufC8 *SpecificEscapeEncodeL(const TDesC8 &, const TDesC8 &)

Detailed Description

Comments : Provides an API to allow data to be escape encoded and decoded. Also provide an API for converting a UNICODE data (16-bit descriptor) into UTF8 data (8-bit descriptor) and vice-verse.
Since
6.0

Member Enumeration Documentation

Enum TEscapeMode

enum TEscapeMode Enum defining escaping modes. Each mode has a different set of reserved characters. These are based on various uri components, as decribed in RFC2396.

EnumeratorValueDescription
EEscapeNormal0

Default mode, which has no reserved characters

EEscapeQuery

Mode specifying reserved characters in a uri query - ;/?:&=+$,[]

EEscapePath

Mode specifying reserved characters in a uri path - /;=?[]

EEscapeAuth

Mode specifying reserved characters in a uri authority - /;:@?[]

EEscapeUrlEncoded

Mode specifying reserved characters in a URL ;/?:&=+$[]!\'()~

Member Function Documentation

ConvertFromUnicodeToUtf8L ( const TDesC & )

IMPORT_C HBufC8 *ConvertFromUnicodeToUtf8L(const TDesC &aData)[static]

Converts UNICODE data into UTF8 format.

Since
6.0
leave
KUriUtilsCannotConvert. When the input data cannot be converted.
ParameterDescription
aDataA descriptor with the data to convert.

Returns: A pointer to an 8-bit descriptor buffer which contains UTF8 data.

ConvertToUnicodeFromUtf8L ( const TDesC8 & )

IMPORT_C HBufC *ConvertToUnicodeFromUtf8L(const TDesC8 &aData)[static]

Converts UTF8 format into UNICODE data.

Since
6.0
leave
KUriUtilsCannotConvert. When the input data cannot be converted.
ParameterDescription
aDataA descriptor with the data to convert.

Returns: A pointer to a 16-bit descriptor buffer which contains UNICODE data.

EscapeDecodeL ( const TDesC8 & )

IMPORT_C HBufC8 *EscapeDecodeL(const TDesC8 &aData)[static]

Escape decodes the data.

Since
6.0
ParameterDescription
aDataA descriptor with the data to decode.

Returns: A pointer to a descriptor buffer which contains the escape decoded data.

EscapeDecodeL ( const TDesC16 & )

IMPORT_C HBufC16 *EscapeDecodeL(const TDesC16 &aData)[static]

Escape decodes the data.

Since
6.0
ParameterDescription
aDataA descriptor with the data to decode.

Returns: A pointer to a descriptor buffer which contains the escape decoded data.

EscapeEncodeL ( const TDesC8 &, TEscapeMode )

IMPORT_C HBufC8 *EscapeEncodeL(const TDesC8 &aData,
TEscapeModeaMode
)[static]

Escape encodes excluded and reserved characters in the data as escape triples. The reserved characters are defined by the escape mode. These characters and the set of excluded characters specified by RFC2396 form the entire set of excluded data.

Since
6.0
leave
KUriUtilsErr16BitChar. A 16-Bit character was found in the data to be escape encoded.
ParameterDescription
aDataA descriptor with the data to encode.
aModeAn enum specifying the escape mode.

Returns: A pointer to a descriptor buffer which contains the escape encoded data.

EscapeEncodeL ( const TDesC16 &, TEscapeMode )

IMPORT_C HBufC16 *EscapeEncodeL(const TDesC16 &aData,
TEscapeModeaMode
)[static]

Escape encodes excluded and reserved characters in the data as escape triples. The reserved characters are defined by the escape mode. These characters and the set of excluded characters specified by RFC2396 form the entire set of excluded data.

Since
6.0
leave
KUriUtilsErr16BitChar. A 16-Bit character was found in the data to be escape encoded.
ParameterDescription
aDataA descriptor with the data to encode.
aModeAn enum specifying the escape mode.

Returns: A pointer to a descriptor buffer which contains the escape encoded data.

EscapeEncodeL ( const TDesC8 &, const TDesC8 & )

IMPORT_C HBufC8 *EscapeEncodeL(const TDesC8 &aData,
const TDesC8 &aReservedChars
)[static]

Escape encodes excluded and reserved characters in the data as escape triples. These characters and the set of excluded characters specified by RFC2396 form the entire set of excluded data.

Since
6.0
leave
KUriUtilsErr16BitChar. A 16-Bit character was found in the data to be escape encoded.
ParameterDescription
aDataA descriptor with the data to encode.
aReservedCharsA descriptor with the reserved characters.

Returns: A pointer to a descriptor buffer which contains the escape encoded data.

EscapeEncodeL ( const TDesC16 &, const TDesC16 & )

IMPORT_C HBufC16 *EscapeEncodeL(const TDesC16 &aData,
const TDesC16 &aReservedChars
)[static]

Escape encodes excluded and reserved characters in the data as escape triples. These characters and the set of excluded characters specified by RFC2396 form the entire set of excluded data.

Since
6.0
leave
KUriUtilsErr16BitChar. A 16-Bit character was found in the data to be escape encoded.
ParameterDescription
aDataA descriptor with the data to encode.
aReservedCharsA descriptor with the reserved characters.

Returns: A pointer to a descriptor buffer which contains the escape encoded data.

IsEscapeTriple ( const TDesC8 &, TInt & )

IMPORT_C TBoolIsEscapeTriple(const TDesC8 &aData,
TInt &aHexValue
)[static]

Checks for an escape triple at the start of the input descriptor. If there is a triple its value is calculated and returned through the output argument aHexValue. If there is no escape triple then this argument is left unchanged.

Since
6.0
ParameterDescription
aDataThe descriptor to be checked for an escape triple.
aHexValueThe output argument with the value of the escape triple if it exists.

Returns: A boolean value of ETrue if there is an escape triple at the start of the input descriptor, EFalse otherwise.

IsEscapeTriple ( const TDesC16 &, TInt & )

IMPORT_C TBoolIsEscapeTriple(const TDesC16 &aData,
TInt &aHexValue
)[static]

Checks for an escape triple at the start of the input descriptor. If there is a triple its value is calculated and returned through the output argument aHexValue. If there is no escape triple then this argument is left unchanged.

Since
6.0
ParameterDescription
aDataThe descriptor to be checked for an escape triple.
aHexValueThe output argument with the value of the escape triple if it exists.

Returns: A boolean value of ETrue if there is an escape triple at the start of the input descriptor, EFalse otherwise.

IsExcludedChar ( TChar )

IMPORT_C TBoolIsExcludedChar(TCharaChar)[static]

Checks to see if the input argument is excluded.

Since
6.0
ParameterDescription
aCharThe character to be checked.

Returns: A boolean value of ETrue if the character is an excluded one, or EFalse if it is not.

ReEscapeEncodeL ( const TDesC8 & )

HBufC8 *ReEscapeEncodeL(const TDesC8 &aData)[static]

escape encode only those characters that cannot be in a URI. assume all hh are encoded already.

ParameterDescription
aDataThe descriptor buffer to be escape encoded.

Returns: A pointer to a descriptor buffer which contains the escape encoded data.

SpecificEscapeEncodeL ( const TDesC8 &, const TDesC8 & )

IMPORT_C HBufC8 *SpecificEscapeEncodeL(const TDesC8 &aData,
const TDesC8 &aCharsToEscape
)[static]

returns the escape encoded descriptor output. This checks the every character of aData against aCharsToEscape and if it exist then it escape encodes that character.

ParameterDescription
aDataThe descriptor to be checked against escaping set of characters.
aCharsToEscapeThe set of escape characters.

Returns: A pointer to the escape encoded descriptor.