Cannot get QT Gui Application to display chinese
Hello, I am new to the QT SDK 4.6.1 and currently learning qt through C++-GUI-Programming-with-Qt-4-1st-ed
I am trying to display some chinese words in a simple qt windows and it shows up all rubbish.
here is the code
Code:
#include <QApplication>
#include <QLabel>
int main( int argc, char* argv[])
{
QLabel *label
= new QLabel("XXXX");
//where XXXX is chinese character label -> show();
return app.exec()
}
The code ran well and showed a little windows, the only problem is that the chinese character are messed up.
It would be nice if someone can show me how to solve these problems or I might as well just go back to MFC.
ps.
I've been search through internet for solutions; however, nothing mentionable has been found. I've read the internationlization with QT and tried
and it did not work. I donno the tr() function as there is no real example that solved the multi-langue display problem
Re: Cannot get QT Gui Application to display chinese
Re: Cannot get QT Gui Application to display chinese
In what encoding is the chinese character you are trying to put into this QString?
Re: Cannot get QT Gui Application to display chinese
Quote:
Originally Posted by
wysota
In what encoding is the chinese character you are trying to put into this QString?
I want to encode traditional chinese. It would be nice if I am able to encode simpliied chinese too
Re: Cannot get QT Gui Application to display chinese
No, you didn't understand me. I'm asking what is the text encoding of the characters you input in the file. I'm not asking whether it is simplified or traditional, I'm asking about the glyph encoding. If you don't know what that is, please ask your favourite web search engine. I can give you a hint, it could be BIG-5, but it could also be UTF-8 or something else.
You can start reading here: http://en.wikipedia.org/wiki/Chinese_character_encoding
Re: Cannot get QT Gui Application to display chinese
wysota was correct.
For specific details on Qt and Chinese characters, refer http://hi.baidu.com/cyclone/blog/ite...d6538dbf1.html
Re: Cannot get QT Gui Application to display chinese
Quote:
Originally Posted by
jezz
Thank you. that blog was a great help