Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Displaying Japanese characters in Qt
I am trying to display Japanse characters on my display using QPainter. I followed the below approaches
1, Set the QFont to "japanse", set font size to 24 and font set as bold, (pasted the code snippet below) I expected the output to be displayed in white colour with a blue outline and with the above mentioned font parameters, but the text was displayed in blue colour with a lesser font size and was not bold.
2, I tried as per mentioned in the post http://qt-project.org/forums/viewthread/32704 but I am getting junk characters in the display.
QPainter * painter1;
this->m_textFont.setPointSize(24); //increased text font size from 21 to 23 for error messages and date and time
[edit: Added missing coding tags @ SGaist]
Hi, and welcome to the Qt Dev Net!
[/quote]This requires your .cpp file to be encoded in UTF-8. Have you checked that you have saved it in UTF-8, and not SHIFT-JIS or something else?
Also, what OS and compiler are you using?
We are using linux (Kernel version 2.6.35) and gcc compiler.
The file is saved in UTF-8-BOM encoding.
We followed the approach 2 as mentioned above and used the font "osaka.unicode" instead of "katakana", now we are able to display the japanese characters on our screen.