QT5 C++: UTF-8, QString, QByteArray, *char and Russian symbols. How to change the element in the array *char?

QString is in UTF-8, I need to get from it an array of *char, do this:
QString word = "Word";
QByteArray ar = word.toUtf8();
char* FirstArray = ar.data();
FirstArray[0] = 'X';
QString word1 = QString::fromUtf8(ar.data());

And word1 is equal to X´┐ŻLovo, not Glovo. How to fix?
July 2nd 19 at 17:20
1 answer
July 2nd 19 at 17:22
Solution
In UTF-8 one character is from one to four bytes. Humble yourselves, and if you want to change the Russian letter (2 bytes) in English (1 byte), it is better to work in UTF-16.
word1 = word;
word1[0] = 'X';

or
word1 = QString::fromUtf8(ar.data());
word1[0] = 'X';

And if it is not possible to parse UTF-8, of course.

In General, MBCS is not convenient for such operations.

Find more questions by tags QtC++