Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix regexp in XMP parser to work in Unicode mode

Dmitry Kazakov62fc0bdc2ac1
diff --git a/plugins/metadata/xmp/kis_xmp_io.cpp b/plugins/metadata/xmp/kis_xmp_io.cpp
index e7abb6a6d1..c75d2b982f 100644
--- a/plugins/metadata/xmp/kis_xmp_io.cpp
+++ b/plugins/metadata/xmp/kis_xmp_io.cpp
@@ -180,7 +180,13 @@ bool parseTagName(const QString &tagString,
}
if (numSubNames == 2) {
+ /**
+ * We use Unicode-matching mode, because according to XML specification
+ * the name of an entity can contain Unicode characters.
+ */
QRegularExpression regexp("([A-Za-z]\\w+)/([A-Za-z]\\w+):([A-Za-z]\\w+)");
+ regexp.setPatternOptions(QRegularExpression::UseUnicodePropertiesOption);
+
QRegularExpressionMatch match;
if (tagString.contains(regexp, &match)) {
structName = match.captured(1);
@@ -195,6 +201,8 @@ bool parseTagName(const QString &tagString,
}
QRegularExpression regexp2("([A-Za-z]\\w+)\\[(\\d+)\\]/([A-Za-z]\\w+):([A-Za-z]\\w+)");
+ regexp2.setPatternOptions(QRegularExpression::UseUnicodePropertiesOption);
+
QRegularExpressionMatch match2;
if (tagString.contains(regexp2, &match2)) {
structName = match2.captured(1);