Unsolved QString Utf8 and latin1 difference
-
Hi,
I am using QT-5.
I have used the below code:
QString str1= QString::fromLatin1("abc÷ßàéöø");
QString str= QString::fromUtf8("abc÷ßàéöø");
if (str1==str)
ui->textEdit_2->setText("true");
else
ui->textEdit_2->setText("false");This always results in false.
Why is it like this?
Internally QString should be in same format,its character pointer which have different format,for which we use fromLatin1 or fromUtf8. -
In fact you test the encoding of your source editor.
Results of str and str1 with utf8 or Latin1 encodings set in QtCreator:
"abc������" "abc÷ßàéöø" -> latin1
"abc÷ßàéöø" "abc÷Ã\u009Fà éöø" -> utf8 -
Does this mean that latin1 and utf8 strings which are converted from character pointers won't be same if it's having extended acsii characters?
-