summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/linguist/lupdate/cpp.cpp8
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp8
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result6
3 files changed, 20 insertions, 2 deletions
diff --git a/src/linguist/lupdate/cpp.cpp b/src/linguist/lupdate/cpp.cpp
index 31f1f7e91..a5654cc58 100644
--- a/src/linguist/lupdate/cpp.cpp
+++ b/src/linguist/lupdate/cpp.cpp
@@ -1493,13 +1493,17 @@ QString CppParser::transcode(const QString &str)
if (c == '\n')
continue;
- if (c == 'x') {
+ if (c == 'x' || c == 'u' || c == 'U') {
+ const bool unicode = (c != 'x');
QByteArray hex;
while (i < in.length() && isxdigit((c = in[i]))) {
hex += c;
i++;
}
- out += hex.toUInt(0, 16);
+ if (unicode)
+ out += QString(QChar(hex.toUInt(nullptr, 16))).toUtf8();
+ else
+ out += hex.toUInt(nullptr, 16);
} else if (c >= '0' && c < '8') {
QByteArray oct;
int n = 0;
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
index 3f3a99c48..1bc1dc2a2 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
@@ -647,3 +647,11 @@ QObject::tr("message after system include without space");
#include"qobject.h"
QObject::tr("message after local include without space");
+
+
+
+// QTBUG-35164: handling of \uNNNN escapes
+QString unicodeEscape()
+{
+ return QApplication::tr("Context", "soft\u00ADhyphen");
+}
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
index 683c2aef3..c344667cf 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
@@ -295,6 +295,12 @@ backslashed \ stuff.</source>
<comment>Translate this string to the string &apos;LTR&apos; in left-to-right languages or to &apos;RTL&apos; in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout.</comment>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <location filename="main.cpp" line="656"/>
+ <source>Context</source>
+ <comment>soft­hyphen</comment>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>QCoreApplication</name>