×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    73

    How do I cast/convert TBuf16 to TBuf8 ?

    Hello,

    How can I cast or convert TBuf16-descriptor to TBuf8-descriptor?

    Thanks.

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    271

    RE: How do I cast/convert TBuf16 to TBuf8 ?

    Hi,

    Use...
    Header: #include <utf.h>
    Link in .mmp: charconv.lib

    class CnvUtfConverter // see SDK's Help for reference

    CnvUtfConverter::ConvertFromUnicodeToUtf8(TDes8& aUtf8, const TDesC16& aUnicode, TBool aGenerateJavaConformantUtf8=EFalse);

    Regards,
    FN Developer Support

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    73

    RE: How do I cast/convert TBuf16 to TBuf8 ?

    Thanks.
    But I was looking to way to simply cast it.
    I know it can easily be done with:

    TBuf16<10> txt16;
    txt16=_L("foo"

    TBuf8<10> txt8;

    >> txt8.Copy(txt16);
    or
    >> txt8.Append(txt16);

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    33

    RE: How do I cast/convert TBuf16 to TBuf8 ?

    Use this macro to cast a 16-bit descriptor to an 8-bit one:

    #define _CONVERT_TO_TPTR8(x) TPtr8((TText8*)(x.Ptr()),x.Length()*(sizeof(TText)/sizeof(TText8)))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×