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() ...@@ -569,7 +569,7 @@ void RewriterView::resetToLastCorrectQml()
m_textModifier->textDocument()->undo(); m_textModifier->textDocument()->undo();
m_textModifier->textDocument()->clearUndoRedoStacks(QTextDocument::RedoStack); m_textModifier->textDocument()->clearUndoRedoStacks(QTextDocument::RedoStack);
ModelAmender differenceHandler(; ModelAmender differenceHandler(;
m_textToModelMerger->load(m_textModifier->text().toUtf8(), differenceHandler); m_textToModelMerger->load(m_textModifier->text(), differenceHandler);
leaveErrorState(); leaveErrorState();
} }
...@@ -759,7 +759,7 @@ void RewriterView::qmlTextChanged() ...@@ -759,7 +759,7 @@ void RewriterView::qmlTextChanged()
switch (m_differenceHandling) { switch (m_differenceHandling) {
case Validate: { case Validate: {
ModelValidator differenceHandler(; ModelValidator differenceHandler(;
if (m_textToModelMerger->load(newQmlText.toUtf8(), differenceHandler)) if (m_textToModelMerger->load(newQmlText, differenceHandler))
lastCorrectQmlSource = newQmlText; lastCorrectQmlSource = newQmlText;
break; break;
} }
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