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

Qt may call ucnv_getDefaultName() without calling setlocale() first

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P3: Somewhat important
    • None
    • 5.6.2
    • Core: Locales (i18n)
    • None
    • FreeBSD 12-CURRENT, Qt 5.6.2

    Description

      When using ICU, Qt may call ucnv_getDefaultName() without calling setlocale(.., "") first, which is required before calling ucnv_getDefaultName().
      One such possible path is:
      QString::fromLocal8Bit() -> QTextCodec::codecForLocale() -> QIcuCodec::defaultCodecUnlocked() -> ucnv_getDefaultName()

      setlocale() is called in QCoreApplicationPrivate::initLocale(), which may not have been called.
      A call to initLocale() should be added to QIcuCodec::defaultCodecUnlocked(). When not using ICU, initLocale() is called in setupLocaleMapper(), so it should also be done when using ICU, or the call can be moved into QTextCodec::codecForLocale().

      A real problem appears when using Gwenview 16.11.90 from KDE5 on FreeBSD with locale set to zh_CN.UTF-8. It cannot display image files which have Chinese characters in their paths.

      Attachments

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

        Activity

          People

            cnn Qt Core & Network
            henryhu Henry Hu
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes