Converting text to Unicode text
CCnvCharacterSetConverter API is designed to be used when converting texts that is written in some other than Unicode format. Following function shows how it can be used to for text conversions:
void ConvertTextL(const TDesC8& aData,TDes& aText, TUint aConverter)
TInt state = CCnvCharacterSetConverter::KStateDefault;
CCnvCharacterSetConverter* CSConverter =
if (CSConverter->PrepareToConvertToOrFromL(aConverter,iFs) !=
const TInt returnValue =
if (returnValue <= 0) // < error
aData is used to pass the text as byte buffer, you can get file read to the file buffer for example by using file reading example codes. aText is then used to store the Unicode text, note that with this example caller is responsible on allocating enough long buffer for the aText. aConverter is then character converters identifier, to get this value you could query supported character sets with following function:
CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* CharSets =
for(TInt i=0; i < CharSets->Count(); i++)
CleanupStack::PopAndDestroy(); // CharSets
Which with you can get the value for aConverter from the Identifier()-function. The Name()-function has the name associated with the converter, this could be the full name for the converters file, or character sets name (like windows-874), to check which one the Name()-function returns, you could use NameIsFileName() function.
Note that supported character sets depends on the device’s model and can vary significantly between different devices. Also TIS-620, is named TIS_620 quite often, thus if you require some specific character converter to be present, you should check it manually from all target devices.