Results 1 to 6 of 6

Thread: I have a problem ,how to get chinese unicode ?

  1. #1
    Join Date
    Apr 2009
    Posts
    35
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Android

    Default I have a problem ,how to get chinese unicode ?

    i use
    QChar('影').unicode();
    compiler

    Warning: multi-byte character constant

    how to get chinese's unicode ?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: I have a problem ,how to get chinese unicode ?

    Either use utf-8 or check the unicode value of the glyph you want to encode and provide it in decimal or hexadecimal form - there is a QChar constructor variant taking two uints.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2009
    Posts
    35
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Android

    Default Re: I have a problem ,how to get chinese unicode ?

    Quote Originally Posted by wysota View Post
    Either use utf-8 or check the unicode value of the glyph you want to encode and provide it in decimal or hexadecimal form - there is a QChar constructor variant taking two uints.
    i used

    QTextCodec::setCodecForTr(QTextCodec::codecForName ("UTF-8"));

    but , the problem was unsolv

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: I have a problem ,how to get chinese unicode ?

    Setting a codec won't help. You are using multibyte characters in your source code and the compiler doesn't like it. You should only use singlebyte characters in sourcecodes regardless of the language you use.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I have a problem ,how to get chinese unicode ?

    since QChar is multi-byte, shouldnt it be ok to give it a multi-byte unicode value? and even if compiler gives a warning..shouldnt the guy be able to get the chinese unicode?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: I have a problem ,how to get chinese unicode ?

    It's not about QChar. It's about the CPP preprocessor or C++ compiler that issues the warning. QChar can accept unicode characters but you have to give them as two separate 8 bit parts. This is incorrect according to C++ standard: 'aa' (two characters in single quotes) and that's exactly what he is passing.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. problem with show Chinese
    By osmanthus in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2009, 02:49
  2. QProcess and unicode problem
    By ramazangirgin in forum Qt Programming
    Replies: 0
    Last Post: 6th June 2008, 12:22
  3. i have a problem with Qt unicode
    By coder1985 in forum Qt Programming
    Replies: 5
    Last Post: 20th November 2007, 20:08
  4. Unicode problem in hoverlink
    By anju123 in forum Qt Programming
    Replies: 2
    Last Post: 27th August 2007, 13:56
  5. Unicode Character Problem
    By prakash in forum Qt Programming
    Replies: 1
    Last Post: 11th May 2006, 07:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.