From efbec203202e5ff1322aa44a7ecd1ec53d17c552 Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Sun, 28 Aug 2016 01:25:41 +0100 Subject: [PATCH] Fix the compare_locale function by relying on Qt's (#9030) --- src/support/lstrings.cpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/support/lstrings.cpp b/src/support/lstrings.cpp index 6d5f86672f..2c3203b5c7 100644 --- a/src/support/lstrings.cpp +++ b/src/support/lstrings.cpp @@ -208,24 +208,7 @@ int compare_no_case(docstring const & s, docstring const & s2) int compare_locale(docstring const & s, docstring const & s2) { - // FIXME We have a report that this does not work on windows (bug 9030) - try - { - string const l = to_local8bit(s); - string const r = to_local8bit(s2); - return strcoll(l.c_str(), r.c_str()); - } - catch (bad_cast & e) - { - // fall back to builtin sorting - LYXERR0("Could not compare using the current locale: " - << e.what() << ", using fallback."); - if (s < s2) - return -1; - if (s > s2) - return 1; - return 0; - } + return QString::localeAwareCompare(toqstr(s), toqstr(s2)); }