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>
This commit is contained in:
parent
21053b0b31
commit
2302fc9d35
@ -601,7 +601,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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user