From 6ef69bcef2785baf112b6f91f05995fc01869928 Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Wed, 19 May 2021 12:17:27 +0300 Subject: [PATCH] Fix system locale for Integrity Integrity doesn't have langinfo, default locale is C, set to UTF-8 Change-Id: I6a6374195344641f64da895cd5f2745b61af060a Reviewed-by: Kimmo Ollila Reviewed-by: Lars Knoll Reviewed-by: Tuukka Turunen --- src/corelib/kernel/qcoreapplication.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 2969b24801d..b59781a4bf8 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -105,7 +105,9 @@ #ifdef Q_OS_UNIX # include -# include +# ifndef Q_OS_INTEGRITY +# include +# endif # include # include @@ -591,6 +593,9 @@ void QCoreApplicationPrivate::initLocale() return; qt_locale_initialized = true; +#ifdef Q_OS_INTEGRITY + setlocale(LC_CTYPE, "UTF-8"); +#else // Android's Bionic didn't get nl_langinfo until NDK 15 (Android 8.0), // which is too new for Qt, so we just assume it's always UTF-8. auto nl_langinfo = [](int) { return "UTF-8"; }; @@ -623,6 +628,7 @@ void QCoreApplicationPrivate::initLocale() codec, oldLocale.constData(), newLocale.constData()); } #endif +#endif }