×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    26

    Question Unicode data in the CBrCtlInterface::LoadDataL() function

    Hi,

    I am wondering how to display unicode data in the browser control when using the LoadDataL() function. Since the second parameter of this function takes a TDesC8 i.e.

    void LoadDataL(const TDesC& aUrl,
    const TDesC8& aData,
    const TDataType& aDataType,
    TUid aCharsetUid);

    and I can't do something like this:

    _LIT(KData, "<html><head><title>Hello</title></head><body><h1>احمد</h1></body></html>");

    TUid uid;
    uid.iUid = KCharacterSetIdentifierUtf8;
    iBrowserControl->LoadDataL(KUrl, KData , dataType, uid); // wont compile.

    it will compile like so:

    _LIT8(KData, "<html><head><title>Hello</title></head><body><h1>احمد</h1></body></html>");

    but then it will show garbage. I dont want to load a file. I want to use the buffer. Any ideas on how to achieve this ?

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

    Re: Unicode data in the CBrCtlInterface::LoadDataL() function

    Since 8-bit descriptors are not Unicode, you may want to use UTF-8 encoding. The KCharacterSetIdentifierUtf8 also suggests that.
    CnvUtfConverter can help, like:
    Code:
    _LIT(KData, "<html><head><title>Hello</title></head><body><h1>احمد</h1></body></html>");
    
    TUid uid;
    uid.iUid = KCharacterSetIdentifierUtf8;
    
    HBufC8 *utf8=CnvUtfConverter::ConvertFromUnicodeToUtf8L(KData);
    CleanupStack::PushL(utf8);
    iBrowserControl->LoadDataL(KUrl, *utf8 , dataType, uid);
    CleanupStack::PopAndDestroy(); // utf8

Similar Threads

  1. error LNK2019: unresolved external symbol ???
    By wgarnett in forum Symbian
    Replies: 3
    Last Post: 2009-09-28, 06:53
  2. a function return value problem
    By letmefly111 in forum Symbian
    Replies: 3
    Last Post: 2007-07-23, 20:50
  3. Replies: 3
    Last Post: 2005-08-01, 13:39
  4. Unicode Song Title In NSM Ringtone
    By mcai7db3 in forum Smart Messaging
    Replies: 3
    Last Post: 2002-08-28, 06:58
  5. Internet Access Config via Smart Message
    By ajbrindley in forum Smart Messaging
    Replies: 1
    Last Post: 2002-08-14, 07:56

Posting Permissions

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