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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.6.2
    • Fix Version/s: None
    • Component/s: Core: Locales (i18n)
    • Labels:
      None
    • Environment:
      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

            Assignee:
            cnn Qt Core & Network
            Reporter:
            henryhu Henry Hu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes