Join Today
+ Reply to Thread
Results 1 to 4 of 4
  1. #1

    Default chinese strings...

    I'm trying to display chinese strings in a MessageBox but all I see is garbage. I have the chinese characters entered in the code (copy and paste from some chinese file) but still the same garbage is output. Does anyone know how I can solve this problem? I'm using QString's which from what I read supports UTF-8. Thanks.

  2. #2
    Join Date
    Mar 2005
    Location
    NZ
    Posts
    459

    Default Re: chinese strings...

    i use QString::fromUTF8("chinese string") to let it display chinese character ..

    hope this help

  3. #3

    Default Re: chinese strings...

    Quote Originally Posted by mserougi
    I'm trying to display chinese strings in a MessageBox but all I see is garbage. I have the chinese characters entered in the code (copy and paste from some chinese file) but still the same garbage is output. Does anyone know how I can solve this problem? I'm using QString's which from what I read supports UTF-8. Thanks.
    you can try this way:

    1)write a function "toUnicode"

    QString toUnicode(const char *str){
    return QString::fromLocal8Bit(str, strlen(str));
    }

    2)use this function in your program

    ZMessageBox::timerMessage(this,ir.getIcon(RES_ICON_DLG_COMPLETE),toUnicode("Chinese strings"),3);

    3)edit the *.desktop file in target mpkg ball

    Exec=yourprogram -qws -font SSong

  4. #4

    Default Re: chinese strings...

    Quote Originally Posted by intoxicated
    i use QString::fromUTF8("chinese string") to let it display chinese character ..

    hope this help
    works like a charm thanks alot!

    @Chicyu
    thanks for the tip but i guess the other way is simpler

    one more thing...
    can i possibly store a QString chinese string into a std::string?

    nevermind...figured out a way


 
+ Reply to Thread

Similar Threads

  1. Comics Chinese
    By *~Nimsrules~* in forum A1200/E6
    Replies: 1
    Last Post: 01-02-2011, 11:46 AM
  2. I'm Chinese
    By grophia in forum Chinese Lounge
    Replies: 41
    Last Post: 10-31-2008, 02:55 AM
  3. why in Chinese?
    By honduran25 in forum E6 General Chat
    Replies: 9
    Last Post: 08-29-2007, 12:13 AM
  4. Anyone that knows Chinese, please help.
    By Phenomenon in forum A1200 General Chat
    Replies: 4
    Last Post: 02-16-2007, 08:13 AM
  5. any chinese here that can translate this
    By ndpndnt16 in forum E680i General Chat
    Replies: 15
    Last Post: 01-19-2006, 08:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Single Sign On provided by vBSSO

Search Engine Optimization by vBSEO 3.6.0 RC 1