Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: convplug.h

ConvertToUnicode()

TInt ConvertToUnicode(CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, TDes16& aUnicode, const TDesC8& aForeign, TInt& aState, TInt& aNumberOfUnconvertibleCharacters, TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);

Support

Supported from 6.0

Description

A function prototype which must be implemented by a character conversion plug-in DLL to convert from a foreign character set into Unicode. This function is exported at ordinal position 3 in the plug-in DLL. It is called by CCnvCharacterSetConverter::ConvertToUnicode().

For many non-complex character sets, the implementation of this function is trivial. Include convgeneratedcpp.h in the .cpp file to get access to the SCnvConversionData object called conversionData. Then call CCnvCharacterSetConverter::DoConvertToUnicode() specifying conversionData as the first argument and passing in all other parameters unchanged.

For complex character sets, you need to create an array of character conversion methods (CnvUtilities::SMethods or CnvUtilities::SStates, depending on whether the complex character set encoding is modal or not), then call CnvUtilities::ConvertToUnicodeFromHeterogeneousForeign() or CnvUtilities::ConvertToUnicodeFromModalForeign().

Parameters

CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters

The default endian-ness to use when reading characters in the foreign character set.

TDes16& aUnicode

On return, contains the text converted into Unicode.

const TDesC8& aForeign

The non-Unicode source text to be converted.

TInt& aState

Used to save state information across multiple calls to ConvertToUnicode().

TInt& aNumberOfUnconvertibleCharacters

On return, contains the number of bytes which were not converted.

TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter

On return, contains the index of the first byte in the input text that could not be converted. A negative value indicates that all the characters were converted.

Return value

TInt

The number of unconverted bytes left at the end of the input descriptor (e.g. because the output descriptor is not long enough to hold all the text), or one of the error values defined in TError.