
Originally Posted by
anda_skoa
Just checking: you have tried, lets say my first suggestion, right?
I.e. using toLocal8Bit() and it did not work?
#include <QCoreApplication>
#include <QDebug>
int main(int argc, char *argv[])
{
qDebug
() <<
QString::fromUtf8("Привет Мир").
toLocal8Bit();
return a.exec();
}
#include <QCoreApplication>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
qDebug() << QString::fromUtf8("Привет Мир").toLocal8Bit();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Cheers,
_
Thank you. It doesn't work.
Added after 19 minutes:
Why it doesn't work?
#include <QCoreApplication>
#include <QDebug>
#include <QTextStream>
int main(int argc, char *argv[])
{
qDebug() << russian;
cout << russian << endl;
cout.flush();
return a.exec();
}
#include <QCoreApplication>
#include <QDebug>
#include <QTextStream>
QTextStream cout(stdout);
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QString russian = QString::fromUtf8("Привет, Мир!");
qDebug() << russian;
cout << russian << endl;
cout.flush();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Output:
"â•§ÐштхЄ, ╠шÐ!"
â•§ÐштхЄ, ╠шÐ!
Added after 4 minutes:
I don't understand what is it:
Привет, Мир!
"Привет,"
Привет,
#include <QCoreApplication>
#include <QDebug>
#include <QTextStream>
int main(int argc, char *argv[])
{
cin >> input;
qDebug() << russian;
cout << russian << endl;
cout.flush();
return a.exec();
}
#include <QCoreApplication>
#include <QDebug>
#include <QTextStream>
QTextStream cin(stdin);
QTextStream cout(stdout);
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QString input;
cin >> input;
QString russian = QString::fromUtf8(input.toUtf8());
qDebug() << russian;
cout << russian << endl;
cout.flush();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks