Skip to content
This repository was archived by the owner on Jun 19, 2020. It is now read-only.

Add support for comments containing Unicode - #12

Open
DevynCJohnson wants to merge 1 commit into
ambv:masterfrom
DevynCJohnson:master
Open

DevynCJohnson wants to merge 1 commit into
ambv:masterfrom
DevynCJohnson:master

Conversation

@DevynCJohnson

Copy link
Copy Markdown

When using Flake8 (with Flake8-Mypy) on Python scripts containing comments with Unicode comments, Flake8 crashes with a UnicodeEncodeError. The suggested code in my commit appears to resolve the issue without side-effects.

When using Flake8 (with Flake8-Mypy) on Python scripts containing comments with Unicode comments, Flake8 crashes with a UnicodeEncodeError. The suggested code in my commit appears to resolve the issue without side-effects.
@ambv

ambv commented May 20, 2018

Copy link
Copy Markdown
Owner

I don't understand how the current behavior (which sets encoding to 'utf8' in the NamedTemporaryFile) is any worse than your suggested encoding of every line to utf8 and writing in binary.

Comment thread flake8_mypy.py
) as f:
self.filename = f.name
for line in self.lines:
f.write(line.encode(r'utf8'))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line.encode() here might fail exactly like the f.write() line above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants