Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: convplug.h

ConvertFromUnicode()

TInt ConvertFromUnicode(CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, TDes8& aForeign, const TDesC16& aUnicode, CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters);

Support

Supported from 6.0

Description

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

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::DoConvertFromUnicode() specifying conversionData as the first argument and passing in all parameters unchanged.

For complex character sets, you need to create an array of character conversion data objects (CnvUtilities::SCharacterSets), then call CnvUtilities::ConvertFromUnicode().

Parameters

CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters

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

const TDesC8& aReplacementForUnconvertibleUnicodeCharacters

The single character which is used to replace unconvertible characters.

TDes8& aForeign

On return, contains the converted text in the target non-Unicode character set.

const TDesC16& aUnicode

The source Unicode text to be converted.

CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters

A buffer which on return holds the indices of each Unicode character in the source text which could not be converted (because the target character set does not have an equivalent character).

Return value

TInt

The number of unconverted characters left at the end of the input descriptor (e.g. because aForeign was not long enough to hold all the text), or a negative error value, as defined in TError.