summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2023-06-19 12:05:15 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-06-20 06:26:26 +0000
commit2e5dd66c77a4d432a68e2f17e1548de046123c7a (patch)
tree7bd53739ccec820bf3e1edda761c2093e18f674a /src
parentedd7b5de76e7bb4386e1b6b7694e1f47e4f3e922 (diff)
Accept any printable character in CAN DBC char_string
CAN DBC char_string can accept any printable character, according to standard specification. For now, only 0x20 - 0x7E were accepted, which made some possible characters, including e.g. the degree sign U+00B0 to not get correctly parsed. Fixes: QTBUG-114619 Change-Id: I51766e847110641f786ab1f5f3aed89572335d6f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de> (cherry picked from commit c7cdbe4cc4ba4b4456a4cbab4eaea2ea9b6326ed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/serialbus/qcandbcfileparser.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/serialbus/qcandbcfileparser.cpp b/src/serialbus/qcandbcfileparser.cpp
index 63d4f98..c32c9bb 100644
--- a/src/serialbus/qcandbcfileparser.cpp
+++ b/src/serialbus/qcandbcfileparser.cpp
@@ -306,9 +306,8 @@ static constexpr auto kMaybeSpaceRegExp = "[ ]*"_L1;
static constexpr auto kMuxIndicatorRegExp = "M|m\\d+M?"_L1;
static constexpr auto kByteOrderRegExp = "0|1"_L1;
static constexpr auto kValueTypeRegExp = "\\+|\\-"_L1;
-// The pattern matches all ASCII characters in range 0x20 - 0x7E, except
-// double-quote (") and backslash (\).
-static constexpr auto kCharStrRegExp = "((?![\\\"\\\\])[\x20-\x7e])*"_L1;
+// The pattern matches all printable characters, except double-quote (") and backslash (\).
+static constexpr auto kCharStrRegExp = "((?![\\\"\\\\])\\P{Cc})*"_L1;
void QCanDbcFileParserPrivate::reset()
{
@@ -341,7 +340,7 @@ bool QCanDbcFileParserPrivate::parseFile(const QString &fileName)
m_seenExtraData = false;
while (!f.atEnd()) {
- const QString str = QString::fromLatin1(f.readLine().trimmed());
+ const QString str = QString::fromUtf8(f.readLine().trimmed());
if (!processLine({str.constData(), str.size()})) // also sets the error properly
return false;
}