summarylogtreecommitdiffstats
path: root/fix-genlang.diff
blob: 5d05518e0da812eb8042fc3456e2149b0b83381c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff --git a/Telegram/SourceFiles/_other/genlang.cpp b/Telegram/SourceFiles/_other/genlang.cpp
index 2f66b5c..c5f5eae 100644
--- a/Telegram/SourceFiles/_other/genlang.cpp
+++ b/Telegram/SourceFiles/_other/genlang.cpp
@@ -274,10 +274,22 @@ QString escapeCpp(const QByteArray &key, QString value) {
 				res.append('"');
 				instr = false;
 			}
-			res.append(' ').append('u').append('"').append('\\').append('x').append(QString("%1").arg(ch->unicode(), 4, 16, QChar('0'))).append('"');
+			res.append(' ');
+			if (false) {
+				res.append('L').append('"').append('\\').append('x').append(QString("%1").arg(ch->unicode(), 4, 16, QChar('0'))).append('"');
+			} else {
+				res.append('"');
+				QByteArray utf(QString(*ch).toUtf8());
+				for (const unsigned char *uch = (const unsigned char *)utf.constData(), *ue = (const unsigned char *)utf.constData() + utf.size(); uch != ue; ++uch) {
+					res.append('\\').append('x').append(QString("%1").arg(ushort(*uch), 2, 16, QChar('0')));
+				}
+				res.append('"');
+			}
 		} else {
 			if (!instr) {
-				res.append(' ').append('u').append('"');
+				res.append(' ');
+				if (false) res.append('L');
+				res.append('"');
 				instr = true;
 			}
 			if (ch->unicode() == '\\' || ch->unicode() == '\n' || ch->unicode() == '\r' || ch->unicode() == '"') {
@@ -309,7 +321,7 @@ QString escapeCpp(const QByteArray &key, QString value) {
 		}
 	}
 	if (instr) res.append('"');
-	return "qsl(" + res.mid(1) + ")";
+	return (false ? "qsl(" : "QString::fromUtf8(") + res.mid(false ? 2 : 1) + ")";
 }
 
 void writeCppKey(QTextStream &tcpp, const QByteArray &key, const QString &val) {