Fix engine test failure under flatpak

Geary.ImapDb.Database/utf8_case_insensitive_collation depends on a well
known UTF-8 collation order, but distros only ship C.UTF-8 by default
and Flatpak doesn't ship that, so support en_US.UTF-8 as a fallback.

See https://gitlab.com/freedesktop-sdk/freedesktop-sdk/issues/812
This commit is contained in:
Michael Gratton 2019-06-24 21:00:51 +10:00
parent bed41855a4
commit 7b124abd2e
2 changed files with 23 additions and 4 deletions

View file

@ -10,11 +10,19 @@ int main(string[] args) {
* Initialise all the things.
*/
Test.init(ref args);
// Ensure things like e.g. GLib's formatting routines uses a
// UTF-8-based locale rather ASCII
GLib.Intl.setlocale(LocaleCategory.ALL, "C.UTF-8");
// well-known UTF-8-based locale rather ASCII.
//
// Distros don't ship well-known locales other than C.UTF-8 by
// default, but Flatpak does not currently support C.UTF-8, so
// need to try both. :(
// https://gitlab.com/freedesktop-sdk/freedesktop-sdk/issues/812
string? locale = GLib.Intl.setlocale(LocaleCategory.ALL, "C.UTF-8");
if (locale == null) {
GLib.Intl.setlocale(LocaleCategory.ALL, "en_US.UTF-8");
}
Test.init(ref args);
Geary.RFC822.init();
Geary.HTML.init();