Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use latin1 encoding to decode bytes #5870

Merged
merged 1 commit into from Dec 28, 2021
Merged

Use latin1 encoding to decode bytes #5870

merged 1 commit into from Dec 28, 2021

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Dec 5, 2021

Resolves #5865

That issue reports an error decoding bytes. A self-contained example of that error is

>>> bytes(list(range(46))+[231, 1]).decode()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe7 in position 46: invalid continuation byte

It can be fixed by using "latin1"

>>> bytes(list(range(46))+[231, 1]).decode("latin1")
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-ç\x01'

"latin1" is already used in two other places in setup.py -

Pillow/setup.py

Line 412 in c5d9223

.decode("latin1")
and

Pillow/setup.py

Line 528 in c5d9223

.decode("latin1")

@hugovk hugovk merged commit 39de053 into python-pillow:main Dec 28, 2021
48 of 49 checks passed
@radarhere radarhere deleted the setup branch Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants