×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    Question How to Convert Unicode format to Arabic characters

    When I send HTTP request, I receive it's response in Unicode format for Arabic Characters, via a TDesC8 descriptor:

    \u0627\u0646\u0627 \u0645\u0639\u0627\u0643 \u0628\u0631\u062a\u0627\u062d


    I tried to use following APIs to convert it to human readable form into HBufC16 descriptor:

    EscapeUtils::ConvertFromUnicodeToUtf8L()
    CnvUtfConverter::ConvertFromUnicodeToUtf8L()


    But I end up with the same Unicode format I received.


    Any help or suggestion would be appreciated.
    Many thanks in advance.
    Nokia Asha applications [Price Point Policy] [Unlimited Updates] [Suggestions]: http://www.developer.nokia.com/Community/Discussion/showthread.php?240423-Nokia-Asha-applications-Price-Point-Policy-Unlimited-Updates-Suggestions

  2. #2
    Registered User
    Join Date
    Oct 2008
    Posts
    11

    Re: How to Convert Unicode format to Arabic characters

    Quote Originally Posted by ashraf fawzy View Post
    When I send HTTP request, I receive it's response in Unicode format for Arabic Characters, via a TDesC8 descriptor:

    \u0627\u0646\u0627 \u0645\u0639\u0627\u0643 \u0628\u0631\u062a\u0627\u062d


    I tried to use following APIs to convert it to human readable form into HBufC16 descriptor:

    EscapeUtils::ConvertFromUnicodeToUtf8L()
    CnvUtfConverter::ConvertFromUnicodeToUtf8L()


    But I end up with the same Unicode format I received.


    Any help or suggestion would be appreciated.
    Many thanks in advance.
    Hi,

    There is a known issue regarding this:
    http://www.developer.nokia.com/Commu...bic_characters

    It does not have the solution but it says why its happening.. Might be useful in ur case.

    -\ Nirab...

  3. #3
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,988

    Re: How to Convert Unicode format to Arabic characters

    Quote Originally Posted by nirab.kumar View Post
    Hi,

    There is a known issue regarding this:
    http://www.developer.nokia.com/Commu...bic_characters

    It does not have the solution but it says why its happening.. Might be useful in ur case.

    -\ Nirab...
    Its not at all related to the problem which the thread creator has posted here.The link which you have specified is for java apps & secondly it says something about some alignment issue in display of arabic text.

  4. #4
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,988

    Re: How to Convert Unicode format to Arabic characters

    If i simply draw the text "u0627\u0646\u0627 \u0645\u0639\u0627\u0643 \u0628\u0631\u062a\u0627\u062d", then what is drawn is 'F'E9'C & the result after using ConvertFromUnicodeToUtf8L is same.

  5. #5
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    Re: How to Convert Unicode format to Arabic characters

    So, is there more suggestions on how to solve the problem?

    Many thanks in advance.
    Nokia Asha applications [Price Point Policy] [Unlimited Updates] [Suggestions]: http://www.developer.nokia.com/Community/Discussion/showthread.php?240423-Nokia-Asha-applications-Price-Point-Policy-Unlimited-Updates-Suggestions

  6. #6
    Regular Contributor
    Join Date
    Nov 2009
    Posts
    200

    Re: How to Convert Unicode format to Arabic characters

    If I understood correctly your string "\u0627\u0646\u0627 \u0645\u0639\u0627\u0643 \u0628\u0631\u062a\u0627\u062d" is not actually in Unicode (UCS-2) format but it's "normal" string with 8-bit ANSI characters representing Unicode codepoints. To make the functions you mentioned work you would need first to convert every Unicode codepoint to UCS-2, where "\u0627" would be 0x0627 (16 bits in hex). Probably such conversion function exists somewhere, but I don't know where.

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,673

    Re: How to Convert Unicode format to Arabic characters

    It is somewhat unlikely that a Web-server would really send you the string \u0627\u0646... Web-servers more likely use character references, which would look like ان... in this particular case or perhaps UTF-8 format (which is rather unreadable for non-ASCII, so I do not try reproducing here) but that is more typical for XML.
    Can it happen that you see \u0627\u0646... in the debugger of Carbide.c++. If that is the case, decoding is complete and the phone will show the proper characters (or boxes, depending on the availability of the characters). Carbide.c++ does not show non-ASCII characters, it shows the character codes instead.

  8. #8
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    Re: How to Convert Unicode format to Arabic characters

    Hello Wizard,

    Actually that's what I see when I receive the response in desktop web browser; and it's the same when I receive it via HTTP GET, and I draw it or view it via CEikonEnv::InfoWinL.
    Nokia Asha applications [Price Point Policy] [Unlimited Updates] [Suggestions]: http://www.developer.nokia.com/Community/Discussion/showthread.php?240423-Nokia-Asha-applications-Price-Point-Policy-Unlimited-Updates-Suggestions

  9. #9
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    Re: How to Convert Unicode format to Arabic characters

    Hello again Wizard,

    I tried new way of sending request, and I receive this time the response in XML structure, where the Arabic letters representation is in format you mentioned above ان.... and now I have to ask you what is the proper way to convert it into human readable form letters?

    Many thanks in advance.
    Nokia Asha applications [Price Point Policy] [Unlimited Updates] [Suggestions]: http://www.developer.nokia.com/Community/Discussion/showthread.php?240423-Nokia-Asha-applications-Price-Point-Policy-Unlimited-Updates-Suggestions

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,673

    Re: How to Convert Unicode format to Arabic characters

    Ok, I believe you, just it looked very exotic.
    For the conversion, there is (actually, would be) CMDXMLEntityConverter::EntityToTextL, http://www.symlab.org/main/documenta...9329A240B.html
    Unfortunately this class and method does not appear in the SDK-s. However if you happen to have the ex-open source Symbian^3 code (I tend to believe that you have downloaded it according to one of our older discussions), it is located as \sf\os\xmlsrv\xml\legacyminidomparser\XMLParser\SRC\GMXMLEntityConverter.cpp
    Technically it is just a loop with Locate (for '&' and ';') and TLex (for evaluating the character code) inside, so if you write such code yourself, that will have the same performance.

Similar Threads

  1. How to convert the format from Big5 to unicode?
    By marcusinhk in forum Symbian
    Replies: 0
    Last Post: 2009-03-04, 07:54
  2. arabic characters
    By reshmy in forum Mobile Java General
    Replies: 1
    Last Post: 2008-08-24, 14:14
  3. Arabic Unicode
    By kamranaz2004 in forum Mobile Java General
    Replies: 2
    Last Post: 2008-04-08, 08:11
  4. Arabic Characters
    By srikanth06 in forum General Messaging
    Replies: 4
    Last Post: 2003-05-04, 22:21
  5. SMS-ing with arabic characters
    By enternada in forum General Messaging
    Replies: 3
    Last Post: 2003-04-24, 22:15

Posting Permissions

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