python3-debian fails to load utf-8 changelog

Bug #1464882 reported by peter green
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-debian (Ubuntu)
New
Undecided
Unassigned

Bug Description

Attempting to load a changelog containing non-ascii utf-8 characters using the changlog module python3-debian in ubuntu vivid (version 0.1.22ubuntu1 of python3-debian) fails.

root@debian:/# zcat /usr/share/doc/qt4-doc/changelog.Debian.gz > testchangelog
root@debian:/# file testchangelog
testchangelog: UTF-8 Unicode text
root@debian:/# python3
Python 3.4.3 (default, Mar 26 2015, 22:03:40)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from debian import changelog
>>> f=open('testchangelog')
>>> c=changelog.Changelog(f)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/debian/changelog.py", line 250, in __init__
    strict=strict)
  File "/usr/lib/python3/dist-packages/debian/changelog.py", line 291, in parse_changelog
    for line in file:
  File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 822: ordinal not in range(128)
>>>

According to the sourcecode the default encoding for the changelog module is supposed to be utf-8 but it looks like that never actually gets passed to whatever does the decoding.

Performing the same test in a Debian sid chroot succeeds
Performing the same test with python 2 succeeds

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.