G
G
Grigory2020-04-15 00:14:17
Qt
Grigory, 2020-04-15 00:14:17

What could be causing the qml Text Cyrillic output error?

There was an unusual problem which solution for a day I did not find. The problem occurs only on 1 PC with Windows 10. When I try to display Russian text in qml Text, instead of Russian letters, characters are displayed, as it seemed to me, the Greek alphabet. The first conclusion is that the encoding is down, but I did not find the mechanism for setting it up for qml. When replacing Text with Label, the text started to be displayed correctly, but for example, in TextEdit it also displays the wrong encoding. When copying and pasting, for example, in notepad ++, the text is displayed correctly. Look like this:
5e9626766efea808006176.png
Just in case, the code, although there is nothing special about it.

Connections {
    target: QmlModel
    onDiagnosticCompleted: {
      if(result.length) {
        diagnosticResult.text = "Text:" + result;
        diagnosticResultLabel.text = "Label:" + result;
      }
    }
  }


RowLayout {
        anchors.fill: parent
        id: layout
        Rectangle {
          border.color: "#101010"
          border.width: 1
          Layout.fillWidth: true
          Layout.minimumWidth: 50
          Layout.preferredWidth: 100
          Layout.maximumWidth: 300
          Layout.minimumHeight: 150

          Text {
            id:diagnosticResult
            padding: 5
            anchors.fill: parent
            z:0
          }

        }
        Rectangle {
          border.color: "#101010"
          border.width: 1
          Layout.fillWidth: true
          Layout.minimumWidth: 50
          Layout.preferredWidth: 100
          Layout.maximumWidth: 300
          Layout.minimumHeight: 150

          Label {
            id:diagnosticResultLabel
            anchors.fill: parent
            padding: 5
            z:0
          }

        }
      }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Grigory, 2020-04-15
@Griglapidus

Intermediate result. If you Textset the property , renderType: Text.NativeRenderingthen the text becomes normal. It remains to be seen why this is happening.
Added:
to apply a native render to the entire project, you can insert it qputenv("QML_DISABLE_DISTANCEFIELD", "1");at the beginning mainor through the function

void QQuickWindow::setTextRenderType(QQuickWindow::TextRenderType renderType)
with parameterQQuickWindow::NativeTextRendering

A
Alexander Ananiev, 2020-04-15
@SaNNy32

Try updating your video card driver

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question