on xenial help sign in
Now unicode happy
commit4abf5936070ce9a9191175d8aa43ff4bb5944e4f authorTed Gould <ted@gould.cx> dateMon 14 Apr 2014, 13:12 (13 years ago) parentd1a0d95
2 files changed+7−7
plugins/Unity/Launcher/backend/launcherbackend.cpp+3−3 tests/plugins/Unity/Launcher/launcherbackendtest.cpp+4−4
plugins/Unity/Launcher/backend/launcherbackend.cpp+3−3
@@ -515,7 +515,7 @@ QString LauncherBackend::decodeAppId (const QString& path)
515515 }
516516 }
517517
518− return decoded;
518+ return QString::fromUtf8(decoded);
519519}
520520
521521QString LauncherBackend::encodeAppId (const QString& appId)
@@ -524,14 +524,14 @@ QString LauncherBackend::encodeAppId (const QString& appId)
524524 QString encoded;
525525
526526 for (int i = 0; i < bytes.size(); ++i) {
527− char chr = bytes.at(i);
527+ uchar chr = bytes.at(i);
528528
529529 if ((chr >= 'a' && chr <= 'z') ||
530530 (chr >= 'A' && chr <= 'Z') ||
531531 (chr >= '0' && chr <= '9'&& i != 0)) {
532532 encoded.append(chr);
533533 } else {
534− QString hexval = QString("_%1").arg((ushort)chr, 2, 16, QChar('0'));
534+ QString hexval = QString("_%1").arg(chr, 2, 16, QChar('0'));
535535 encoded.append(hexval.toUpper());
536536 }
537537 }
tests/plugins/Unity/Launcher/launcherbackendtest.cpp+4−4
@@ -120,18 +120,18 @@ private Q_SLOTS:
120120 QTest::newRow("Hyphen test") << "typical-application" << "typical_2Dapplication";
121121
122122 /* Japanese test */
123− QTest::newRow("日本語 test") << "日本語" << "_65_E5_67_2C_8A_9E";
123+ QTest::newRow("日本語 test") << "日本語" << "_E6_97_A5_E6_9C_AC_E8_AA_9E";
124124 }
125125
126126 void testDbusName() {
127127 QFETCH(QString, decoded);
128128 QFETCH(QString, encoded);
129129
130− QString decodeOut = LauncherBackend::decodeAppId(encoded);
131− QCOMPARE(decoded, decodeOut);
132−
133130 QString encodeOut = LauncherBackend::encodeAppId(decoded);
134131 QCOMPARE(encoded, encodeOut);
132+
133+ QString decodeOut = LauncherBackend::decodeAppId(encoded);
134+ QCOMPARE(decoded, decodeOut);
135135 }
136136};
137137