[Qemu-devel] [PATCH v2 0/2] Fix compilation with python-3 if en_US.UTF-8 is unavailable

Matthias Maier posted 2 patches 5 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180615044042.7928-1-tamiko@43-1.org
Test checkpatch passed
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test s390x passed
There is a newer version of this series
[Qemu-devel] [PATCH v2 0/2] Fix compilation with python-3 if en_US.UTF-8 is unavailable
Posted by Matthias Maier 5 years, 9 months ago
Hi,

This new version of the patch is now also fully python2 compatible...

Original message:

  This patch series,
   - removes the PYTHON_UTF8 workaround introduced in d4e5ec877ca
   - adds a different workaround that avoids the locale problem altogether by
     opening files in binary read/write mode and setting encoding/decoding
     (in utf-8) explicitly

  The problem with setting

    LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8

  is that the en_US.UTF-8 locale might not be available. In this case setting
  above locales results in build errors even though another UTF-8 locale was
  originally set [1].

  We propose a different approach to fix the locale dependent encode/decode
  problem in common.py utilizing the binary read/write mode [2,3] and
  decode/encode with explicit UTF-8 encoding arguments [4].

  This approach is preferred over the fix in commit d4e5ec877ca because it is
  (a) locale independent, and (b) does not depend on the en_US.UTF_8 locale
  to be available.

  Best,
  Matthias and Arfrever


[1] https://bugs.gentoo.org/657766
[2] https://docs.python.org/3.6/library/stdtypes.html#bytes.decode
[3] https://docs.python.org/3.6/library/stdtypes.html#str.encode
[4] https://docs.python.org/3/howto/unicode.html