×
Namespaces

Variants
Actions
Revision as of 09:21, 20 July 2012 by hamishwillee (Talk | contribs)

Conversion from TDes8 to TDes16 and vice-versa.

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: savaj (10 Mar 2009)
Last edited: hamishwillee (20 Jul 2012)
Reviewer Approved    Thumbs up icon sm.jpg

Sometimes we need to convert from 8-bit descriptor to 16-bit descriptor, then we use the TDes8::Copy(const TDesC16&) method to convert them to TDes16. TDes8::Copy(const TDesC16&) strips out alternate wide characters while TDes16::Copy(const TDesC8&) pads each character with a trailing zero as part of the copy operation. These methods thus form a rudimentary way of copying and converting when the character set is encoded with one byte per character and the last byte of each wide character is NULL-padded. Symbian provided class CnvUtfConverter to convert from UTF 7 to UTF 8 and vice-versa.

Header : utf.h 
Lib : charconv.lib.
 
TBuf8<10> buffer1;
TBuf16<10> buffer2;
 
buffer1.AppendNum(1234);
CnvUtfConverter::ConvertToUnicodeFromUtf8(buffer2,buffer1);
 
buffer1.Zero();
buffer2.Zero();
buffer2.AppendNum(1234);
CnvUtfConverter::ConvertFromUnicodeToUtf8(buffer2,buffer1);


See also

Converting Descriptors

150 page views in the last 30 days.
×