I spent a whole day trying to figure this out with no luck. I looked Everywhere but no luck with working code.
OS: Win XP Sp2 IDE & FRAMEWORK: C++, Qt Creator 2.0.
I am trying to output some unicode (UTF-8) text to the windows console but all I see is gibberish in place of the unicode chars. I know the win console does support unicode (since win 2000)... at least according to Wikipedia and many on the net but I don't see how to make it work with Qt. Most "solutions" I've seen (haven't seen many) use C++ and WInAPI tech... which I can't use because that is not the Qt way. I am using QStrings and Qt!
Code is bellow. I took out all the different things I tried to keep the code simple for the post. Hope someone can get the code to work.
#include <QtCore/QCoreApplication>
#include <QString>
#include <QTextStream>
#include <QDate>
#include <QFile>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QTextStream qin(stdin);
QTextStream qout(stdout);
//The last 2 chars in QString each need a double slash for an accent.
QString szqLine = QString::fromUtf8("abc áéüóöú őű");
//I want this text console output to be in red text color.
qout << "Bellow are some unicode characters: " << endl;
//The Win XP console does not display the unicode chars correctly!!
//The cosole does not display unicode chars even though it is capable
//according to wikipedia. I just don't know how with Qt.
//I want this text output in white(or default font color, not red.)
qout << szqLine << endl;
//Would be nice to get some unicode input from console too.
qout << "Write some unicode chars like above: " << endl;
QString szqInput;
szqInput = QString::fromUtf8(qin.readLine());
qout << "You wrote: " << endl;
qout << szqInput << endl;
return app.exec();
}