Comment 2 for bug 1827857

Revision history for this message
Simon Poirier (simpoir) wrote :

I've been able to reproduce this bug consistently. It appears python3-apt is at cause. If a non-utf8 locale is configured, apt will returned descriptions in the preferred lang/encoding and python3 fails to interpret them as utf8. Python2.7 did ascii conversion, returning "lossy" unicode conversion but not crashing.

$ grep en_US /etc/locale.gen
en_US ISO-8859-1
# en_US.ISO-8859-15 ISO-8859-15
# en_US.UTF-8 UTF-8

$ LANG=en_US python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import apt
>>> apt.Cache().get("gosa").versions[0].description
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/apt/package.py", line 627, in description
    dsc = records.long_desc if records is not None else None
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 236: invalid start byte