I have a primitive test: the project in msvc2015 and Qt5.9.3.
The file main.cpp
is saved in Unicode as UTF-8 with signature:
I try to show the message box which should show some text on Russian language. The whole code:
#include <QtWidgets/QApplication>
#include <QMessageBox>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QString ttl = QString::fromUtf8("russian_word_1");
QString txt = QString::fromUtf8("russian_word_2");
QMessageBox::information(nullptr, ttl, txt);
return a.exec();
}
And what I receive:
How may this be possible?
Update 1: I want to use UTF-8 exactly with BOM according to the Stackoverflow author's statement:
...It does not make sense to have a string without knowing what encoding it uses ���
Update 2: In this particular case, most likely it is a bug in the compiler.