From a37896da496dbb8029c35660018b28c4725c3e0a Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Mon, 26 Sep 2016 01:47:58 +0200 Subject: [PATCH] Fix locale filtering for UTF-8 on Fedora. locale -a returns the locales using ".utf8" names rather than ".UTF-8". The case-insensitive match does not help because it is "utf8" rather than "UTF-8". So we need to match both with and without the dash. --- src/modules/locale/LocaleConfiguration.cpp | 3 ++- src/modules/locale/LocalePage.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/locale/LocaleConfiguration.cpp b/src/modules/locale/LocaleConfiguration.cpp index ca6316fc5..096d0dc4e 100644 --- a/src/modules/locale/LocaleConfiguration.cpp +++ b/src/modules/locale/LocaleConfiguration.cpp @@ -60,7 +60,8 @@ LocaleConfiguration::fromLanguageAndLocation( const QString& languageLocale, // FIXME: this might be useless if we already filter out non-UTF8 locales foreach ( QString line, linesForLanguage ) { - if ( line.contains( "UTF-8" ) ) + if ( line.contains( "UTF-8", Qt::CaseInsensitive ) || + line.contains( "utf8", Qt::CaseInsensitive ) ) linesForLanguageUtf.append( line ); } diff --git a/src/modules/locale/LocalePage.cpp b/src/modules/locale/LocalePage.cpp index ed166ea35..88b030ffe 100644 --- a/src/modules/locale/LocalePage.cpp +++ b/src/modules/locale/LocalePage.cpp @@ -365,7 +365,8 @@ LocalePage::init( const QString& initialRegion, // because it's not 1995. for ( auto it = m_localeGenLines.begin(); it != m_localeGenLines.end(); ) { - if ( !it->contains( "UTF-8", Qt::CaseInsensitive ) ) + if ( !it->contains( "UTF-8", Qt::CaseInsensitive ) && + !it->contains( "utf8", Qt::CaseInsensitive ) ) it = m_localeGenLines.erase( it ); else ++it;