PDA

View Full Version : Display problem of Arab QString increased from C ++ to QML



amone
9th July 2016, 14:16
when I receive Arabic data from my database, and I want them displayed in a QML file I get movaises characters
noted that it works for the Arabic data inserssion by QML into my Mysql
noted that database MySQL's in UTF8

anda_skoa
9th July 2016, 15:03
Is the font capable of displaying the characters?
Does the UI show arabic when you generate the string programmatically?
When you get the string from the database, rencode it with QString::toUtf8() and write that into a file, can am UTF-8 capable text editor show the correct text?

Cheers,
_

amone
9th July 2016, 15:15
QML pages displaying Arabic except for the string sent by Cpp
I have already used toUTF8 () but the problem remains

anda_skoa
9th July 2016, 18:13
QML pages displaying Arabic except for the string sent by Cpp

"sent" as in property, model or signal=



I have already used toUTF8 () but the problem remains
[/quote]
Not sure what you mean, that wasn't going to change anything, it is for verifying that the string is indeed what you think it is.

Which program did you use to read the file that you've created with that toUtf8() output?

Cheers,
_

amone
9th July 2016, 19:29
I'll try detailer well, my project is composed of two parts, one side create by J2E with Sprin for data processing in Arabic and French, and the other party creates with qt / qml for consomation processed data (select and insert the data located in DB side J2E) via the web service (Casablanca)
when I insert data in Arabic via qml form with POST method data are stored in my DB but when I selected the Arabic data in my DB and displayed in the application qml they are poorly displayed
I use the IDE Visual Studio 2013 for the establishment of application qt / qml

anda_skoa
10th July 2016, 09:03
So your QML application uses a web service API for writing and reading the database?

Is the text correct in the database?
Is the text, as received in the web API response, correct?

Cheers,
_

amone
10th July 2016, 10:13
Yes, data is stored in the database correctly, even if I filled a QML Arabic form and sent it to the DB I found it stored in the database correctly, the problem so just display data received from my database
I have noted that a QString essyer displayed in Arabic in the consol of VS2013 always shows me ??? even with the use of toUtf8 () or fromUtf8 ()

anda_skoa
10th July 2016, 19:05
It the string is correctly stored in the database as verified by an external tool, you'll need to check if the string is correct in the Web API response.
If it is, check if the code that extracts the string from the response.
Then check the extracted value.

Cheers,
_

amone
11th July 2016, 12:14
same for this simple code
qDebug () << (QString::fromUTF8(QString("البت")));
or
qDebug () << (QString::fromUtf8 (QString ("البت").toUtf8 ()).);
the consol displays
????

anda_skoa
11th July 2016, 12:50
The first line make no sense, a QString is never in UTF-8, the second line is just unnecessary double conversion.

Looks like the console can't display arabic symbols or the local 8 bit encoding this encodes do can't.

Which obviously means you can't use it to check your values.

Cheers,
_