Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-138805

QString::localeAwareCompare() inconsistent between ICU and others for non-system default locale

XMLWordPrintable

    • All

      QString::localeAwareCompare() delegates (via a helper)

      • for ICU: via QCollator::defaultCompare() to a default-constructed QCollator, based on a default-constructed QLocale's collation()
      • everwhere else: to system APIs which presumably use the system locale.

      When QLocale::setDefault() has changed the default to something other than the system locale, this will produce inconsistent results. It would be fairly easy to change the QCollator::defaultCompare() side to use the system locale, but it seems logically more correct to have all sides use the default locale, when it isn't the system. This better answer may, however, be hard to implement in practice, as some platforms are using the POSIX backend for QCollator, which can only support the system and C locales.

      We may therefore have to either change ICU's branch to also use the system locale (consistent, but not ideal) or live with the present inconsistency. In any case, we need to document whichever reality we decide to live with: QString::localeAwareCompare() currently says nothing about which locale it's aware of.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            Eddy Edward Welbourne
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes