diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2023-01-17 16:21:24 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-02-03 14:11:18 +0000 |
commit | 7fe0f175d4782f9618149bebd349ff2f8c6cfda8 (patch) | |
tree | b0beb713881f28a4810038c098811b6eb717deae /src/corelib | |
parent | dc7efa92ade49ba4eb7b368d5e611b3838abdbf1 (diff) | |
download | qtbase-7fe0f175d4782f9618149bebd349ff2f8c6cfda8.tar.gz |
Use case-insensitive comparison to compare codec with UTF-8 and utf8
Given that the two candidate "counts as UTF 8" values for codec differ
in case, it seems prudent to use a case-insensitive comparison, in
case we hit UTF8 or utf-8.
Change-Id: I279f83eafa90dd2685c306144c99ec97177d1d3b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 75ae8869fb171493e4d5163910ef3a2034902c7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index e04502dcbd..2a55a8a87e 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -564,7 +564,7 @@ void QCoreApplicationPrivate::initLocale() const char *locale = setlocale(LC_ALL, ""); const char *codec = nl_langinfo(CODESET); - if (Q_UNLIKELY(strcmp(codec, "UTF-8") != 0 && strcmp(codec, "utf8") != 0)) { + if (Q_UNLIKELY(qstricmp(codec, "UTF-8") != 0 && qstricmp(codec, "utf8") != 0)) { QByteArray oldLocale = locale; QByteArray newLocale = setlocale(LC_CTYPE, nullptr); if (qsizetype dot = newLocale.indexOf('.'); dot != -1) |