Public bug reported:

With ICU versions >= 61 QTextCodec::codecForLocale() always returns the
utf-8 codec with mib 106 regardless of the value of the environmental
variable LC_ALL or the available locales.

On bionic, which included ICU 60, codecForLocale() returned the correct
codec.  On eoan and focal, which include ICU 63 and ICU 66, the utf-8
codec is always returned.

The change in behavior is expected due to a documented change in ICU 
https://github.com/unicode-org/icu/commit/d7482c9720b4f71dd9dad0.
However, Qt has not accounted for this change in ICU.

I note that Qt 5.12.8 from
https://download.qt.io/archive/qt/5.12/5.12.8/ is packaged with an older
version of ICU so the combination works correctly.  But on Ubuntu eoan
and focal the included version of ICU is not compatible with the
included Qt.

The included file localetrouble.tar contains
1) demo: a script that builds two tests cases and runs them
2) focal.log: the results of running the demo script on focal
3) bionic.log: the results of running the demo script on bionic
4) test1.cc: a minimal Qt Core application that tries to use the codec from the 
current locale.
5) test1.pro: Qt pro file used to build test1.cc
6) test2.cc: a test program that shows why Qt fails to detect the correct 
locale.  These two lines are executed by QCoreApplicationPrivate::initLocale() 
and *QIcuCodec::defaultCodecUnlocked().
7) test2.pro: Qt pro file used to build test2.cc

The expected results of test1 are that codecForLocale is set based on LC_ALL to 
en_US.iso88591:
env LC_ALL=en_US.iso88591 ./test1
QTextCodec::codecForLocale():  "ISO-8859-1" , mib 4
LC_ALL:  en_US.iso88591

The actual results on focal are:
env LC_ALL=en_US.iso88591 ./test1
QTextCodec::codecForLocale():  "UTF-8" , mib 106
LC_ALL:  en_US.iso88591

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: qtbase5-dev 5.12.8+dfsg-0ubuntu1
ProcVersionSignature: Ubuntu 4.15.0-96.97-generic 4.15.18
Uname: Linux 4.15.0-96-generic x86_64
ApportVersion: 2.20.11-0ubuntu27
Architecture: amd64
CasperMD5CheckResult: skip
Date: Fri Apr 24 14:45:36 2020
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
SourcePackage: qtbase-opensource-src
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: qtbase-opensource-src (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug focal

** Attachment added: "bug demonstration and analysis"
   
https://bugs.launchpad.net/bugs/1874832/+attachment/5359537/+files/localetrouble.tar

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to qtbase-opensource-src in
Ubuntu.
https://bugs.launchpad.net/bugs/1874832

Title:
  QCoreApplications sets QTextCodec::codecForLocale() incorrectly

Status in qtbase-opensource-src package in Ubuntu:
  New

Bug description:
  With ICU versions >= 61 QTextCodec::codecForLocale() always returns
  the utf-8 codec with mib 106 regardless of the value of the
  environmental variable LC_ALL or the available locales.

  On bionic, which included ICU 60, codecForLocale() returned the
  correct codec.  On eoan and focal, which include ICU 63 and ICU 66,
  the utf-8 codec is always returned.

  The change in behavior is expected due to a documented change in ICU 
https://github.com/unicode-org/icu/commit/d7482c9720b4f71dd9dad0.
  However, Qt has not accounted for this change in ICU.

  I note that Qt 5.12.8 from
  https://download.qt.io/archive/qt/5.12/5.12.8/ is packaged with an
  older version of ICU so the combination works correctly.  But on
  Ubuntu eoan and focal the included version of ICU is not compatible
  with the included Qt.

  The included file localetrouble.tar contains
  1) demo: a script that builds two tests cases and runs them
  2) focal.log: the results of running the demo script on focal
  3) bionic.log: the results of running the demo script on bionic
  4) test1.cc: a minimal Qt Core application that tries to use the codec from 
the current locale.
  5) test1.pro: Qt pro file used to build test1.cc
  6) test2.cc: a test program that shows why Qt fails to detect the correct 
locale.  These two lines are executed by QCoreApplicationPrivate::initLocale() 
and *QIcuCodec::defaultCodecUnlocked().
  7) test2.pro: Qt pro file used to build test2.cc

  The expected results of test1 are that codecForLocale is set based on LC_ALL 
to en_US.iso88591:
  env LC_ALL=en_US.iso88591 ./test1
  QTextCodec::codecForLocale():  "ISO-8859-1" , mib 4
  LC_ALL:  en_US.iso88591

  The actual results on focal are:
  env LC_ALL=en_US.iso88591 ./test1
  QTextCodec::codecForLocale():  "UTF-8" , mib 106
  LC_ALL:  en_US.iso88591

  ProblemType: Bug
  DistroRelease: Ubuntu 20.04
  Package: qtbase5-dev 5.12.8+dfsg-0ubuntu1
  ProcVersionSignature: Ubuntu 4.15.0-96.97-generic 4.15.18
  Uname: Linux 4.15.0-96-generic x86_64
  ApportVersion: 2.20.11-0ubuntu27
  Architecture: amd64
  CasperMD5CheckResult: skip
  Date: Fri Apr 24 14:45:36 2020
  ProcEnviron:
   TERM=xterm
   PATH=(custom, no user)
  SourcePackage: qtbase-opensource-src
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qtbase-opensource-src/+bug/1874832/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to