getpelican / feedgenerator

Standalone version of Django's feedgenerator module
BSD 3-Clause "New" or "Revised" License
52 stars 23 forks source link

setup.py fails with UnicodeDecodeError on FreeBSD 12.1-RELEASE-p6 under poudriere #19

Closed neirbowj closed 3 years ago

neirbowj commented 4 years ago

When building the www/py-feedgenerator port in FreeBSD using the poudriere tool, the build fails in the "configure" phase with a UnicodeDecodeError traceback in setup.py. This affects multiple versions of Python 3.

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 11, in <module>
    LONG_DESCRIPTION = open('README.rst').read()
  File "/usr/local/lib/python3.6/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 422: ordinal not in range(128)
*** Error code 1

Analysis

setup.py populates the contents of the package's long_description parameter by opening and reading the README.rst file. The file appears to be UTF-8 encoded, but setup.py does not specify an encoding, which causes the open function to fall back to guessing the encoding based on the platform and environment. In this case, Python guesses ASCII. Since README.rst includes a RIGHT SINGLE QUOTATION MARK (U+2019) character that cannot be represented in ASCII, the decode fails.