Commit c64ae557 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.Rewriter: fixing encoding issue for Qt 4

QString uses utf-16 internally. If we explicitly convert to utf-8
and then use the QByteArray implicit constructor of QString again,
Qt 4 will interpret the utf-8 encoded string as latin1.
This results in a wrong string for everything that is not pure ASCII.

With Qt 5 it works, since the assumed default encoding of QByteArray
is utf-8. Still any conversion does not make sense.

Task-number: QTCREATORBUG-9493
Change-Id: Ifbaa4684e85d0ccd677956eeff88b4cc7d807922
Reviewed-by: default avatarFawzi Mohamed <>
parent d6da0901
......@@ -569,7 +569,7 @@ void RewriterView::resetToLastCorrectQml()
ModelAmender differenceHandler(;
m_textToModelMerger->load(m_textModifier->text().toUtf8(), differenceHandler);
m_textToModelMerger->load(m_textModifier->text(), differenceHandler);
......@@ -759,7 +759,7 @@ void RewriterView::qmlTextChanged()
switch (m_differenceHandling) {
case Validate: {
ModelValidator differenceHandler(;
if (m_textToModelMerger->load(newQmlText.toUtf8(), differenceHandler))
if (m_textToModelMerger->load(newQmlText, differenceHandler))
lastCorrectQmlSource = newQmlText;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment