From 5f5555f4d3c9a507bfc8fad9a008431257bd1ab3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 12 Jun 2012 13:08:43 +0200 Subject: Fix encoding of non-ASCII strings tr() only takes UTF-8 as input, so we must recode to UTF-8. But we can use QLatin1String elsewhere. Task-number: QTBUG-26086 Change-Id: I5932ddc96fb817dbe01106e5f6f2b10f58472d6b Reviewed-by: Eskil Abrahamsen Blomfeldt --- examples/painting/painterpaths/window.cpp | 2 +- examples/painting/transformations/window.cpp | 2 +- examples/sql/masterdetail/database.h | 2 +- examples/widgets/calculator/calculator.cpp | 14 +++++++------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/painting/painterpaths/window.cpp b/examples/painting/painterpaths/window.cpp index 65139fe5d1..3d3eef9d2b 100644 --- a/examples/painting/painterpaths/window.cpp +++ b/examples/painting/painterpaths/window.cpp @@ -184,7 +184,7 @@ Window::Window() rotationAngleSpinBox = new QSpinBox; rotationAngleSpinBox->setRange(0, 359); rotationAngleSpinBox->setWrapping(true); - rotationAngleSpinBox->setSuffix("\xB0"); + rotationAngleSpinBox->setSuffix(QLatin1String("\xB0")); rotationAngleLabel = new QLabel(tr("&Rotation Angle:")); rotationAngleLabel->setBuddy(rotationAngleSpinBox); diff --git a/examples/painting/transformations/window.cpp b/examples/painting/transformations/window.cpp index 76b7597c6c..5f9296be7f 100644 --- a/examples/painting/transformations/window.cpp +++ b/examples/painting/transformations/window.cpp @@ -64,7 +64,7 @@ Window::Window() operationComboBoxes[i] = new QComboBox; operationComboBoxes[i]->addItem(tr("No transformation")); - operationComboBoxes[i]->addItem(tr("Rotate by 60\xB0")); + operationComboBoxes[i]->addItem(tr("Rotate by 60\xC2\xB0")); operationComboBoxes[i]->addItem(tr("Scale to 75%")); operationComboBoxes[i]->addItem(tr("Translate by (50, 50)")); diff --git a/examples/sql/masterdetail/database.h b/examples/sql/masterdetail/database.h index 5ad805bb4d..d879367e24 100644 --- a/examples/sql/masterdetail/database.h +++ b/examples/sql/masterdetail/database.h @@ -84,7 +84,7 @@ static bool createConnection() query.exec("insert into albums values(4, 'Stray Dogs', 2, 2003)"); query.exec("insert into albums values(5, " "'One day you`ll dance for me, New York City', 2, 2004)"); - query.exec("insert into albums values(6, 'Ompa Til Du D\xf8r', 3, 2001)"); + query.exec("insert into albums values(6, 'Ompa Til Du D\xc3\xb8r', 3, 2001)"); query.exec("insert into albums values(7, 'Evig Pint', 3, 2002)"); query.exec("insert into albums values(8, 'Maestro', 3, 2005)"); diff --git a/examples/widgets/calculator/calculator.cpp b/examples/widgets/calculator/calculator.cpp index ef2e8720d4..29503befc5 100644 --- a/examples/widgets/calculator/calculator.cpp +++ b/examples/widgets/calculator/calculator.cpp @@ -73,7 +73,7 @@ Calculator::Calculator(QWidget *parent) } Button *pointButton = createButton(tr("."), SLOT(pointClicked())); - Button *changeSignButton = createButton(tr("\261"), SLOT(changeSignClicked())); + Button *changeSignButton = createButton(tr("\302\261"), SLOT(changeSignClicked())); Button *backspaceButton = createButton(tr("Backspace"), SLOT(backspaceClicked())); Button *clearButton = createButton(tr("Clear"), SLOT(clear())); @@ -84,13 +84,13 @@ Calculator::Calculator(QWidget *parent) Button *setMemoryButton = createButton(tr("MS"), SLOT(setMemory())); Button *addToMemoryButton = createButton(tr("M+"), SLOT(addToMemory())); - Button *divisionButton = createButton(tr("\367"), SLOT(multiplicativeOperatorClicked())); - Button *timesButton = createButton(tr("\327"), SLOT(multiplicativeOperatorClicked())); + Button *divisionButton = createButton(tr("\303\267"), SLOT(multiplicativeOperatorClicked())); + Button *timesButton = createButton(tr("\303\227"), SLOT(multiplicativeOperatorClicked())); Button *minusButton = createButton(tr("-"), SLOT(additiveOperatorClicked())); Button *plusButton = createButton(tr("+"), SLOT(additiveOperatorClicked())); Button *squareRootButton = createButton(tr("Sqrt"), SLOT(unaryOperatorClicked())); - Button *powerButton = createButton(tr("x\262"), SLOT(unaryOperatorClicked())); + Button *powerButton = createButton(tr("x\302\262"), SLOT(unaryOperatorClicked())); Button *reciprocalButton = createButton(tr("1/x"), SLOT(unaryOperatorClicked())); Button *equalButton = createButton(tr("="), SLOT(equalClicked())); //! [4] @@ -165,7 +165,7 @@ void Calculator::unaryOperatorClicked() return; } result = sqrt(operand); - } else if (clickedOperator == tr("x\262")) { + } else if (clickedOperator == tr("x\302\262")) { result = pow(operand, 2.0); } else if (clickedOperator == tr("1/x")) { if (operand == 0.0) { @@ -384,9 +384,9 @@ bool Calculator::calculate(double rightOperand, const QString &pendingOperator) sumSoFar += rightOperand; } else if (pendingOperator == tr("-")) { sumSoFar -= rightOperand; - } else if (pendingOperator == tr("\327")) { + } else if (pendingOperator == tr("\303\227")) { factorSoFar *= rightOperand; - } else if (pendingOperator == tr("\367")) { + } else if (pendingOperator == tr("\303\267")) { if (rightOperand == 0.0) return false; factorSoFar /= rightOperand; -- cgit v1.2.3