×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    46

    problem when using ConvertFromUnicodeToUtf8

    Hi everyone,

    i have a problem when i try to use CnvUtfConverter::ConvertFromUnicodeToUtf8.

    I have a function like that

    void CMByDB::addNewItem(TDesC& fileName, TInt fileType)
    {
    //since my fileName column type is EDbColText8 so i do a conversion like that
    //convert from 16bit to 8bit
    TBuf8<768> aFileName8;
    CnvUtfConverter::ConvertFromUnicodeToUtf8(aFileName8,fileName);
    .....
    }

    but the output of before and after conversion is not same.

    Do you know what is the problem ? Please give me suggestion how to solve it.

    Thank you very much.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,566

    Re: problem when using ConvertFromUnicodeToUtf8

    Quote Originally Posted by devian1001
    but the output of before and after conversion is not same.
    What kind of difference have you experienced?

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    46

    Re: problem when using ConvertFromUnicodeToUtf8

    the character format is all changed. this is what i have experienced. please give me ideas or other solution to convert between 16 bit descriptor and 8 bit descriptor.

    Thank you so much.

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142

    Re: problem when using ConvertFromUnicodeToUtf8

    Are you sure you want to use UTF8, with it characters are not presented as bytes really. Maybe you should try something else, like IS0 8859-1 for example..

    yucca

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,566

    Re: problem when using ConvertFromUnicodeToUtf8

    If you use standard ASCII characters (so the upper 8 bits of your Unicode characters are 0), TDes8::Copy(const TDesC16&) and TDes16::Copy(const TDesC8&) may also help.

  6. #6
    Registered User
    Join Date
    Apr 2007
    Posts
    46

    Re: problem when using ConvertFromUnicodeToUtf8

    sorry yucca, my mistake, i am using the ASCII. I have try what wizard suggested, but the characters in the target also changed. Any other ideas ?
    Anyway, thank so much for your help.

  7. #7
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: problem when using ConvertFromUnicodeToUtf8

    Why don't you post the text that is causing the problem?

  8. #8
    Registered User
    Join Date
    Apr 2007
    Posts
    46

    Re: problem when using ConvertFromUnicodeToUtf8

    Thanks for your reply.

    My source descriptor contains a file path, forexample c:\data\immages\pictures\file1.txt, when i try to use TDes8::Copy(const TDesC16&) like Wizard suggestted. the destination descriptor is not same as source one. The destination looks like this C\aaIae\itrstx0.x╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠

    Please give me suggestion how to solve it. thank you

Similar Threads

  1. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  2. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  3. WAP service problem on Apache
    By bigg_o in forum Browsing and Mark-ups
    Replies: 3
    Last Post: 2005-04-17, 16:05
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36
  5. wireless problem
    By sash_mca in forum Mobile Web Site Development
    Replies: 0
    Last Post: 2003-06-06, 11:34

Posting Permissions

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