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
Open
DevynCJohnson wants to merge 1 commit into
DevynCJohnson wants to merge 1 commit into
Conversation
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.
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. |
ambv
reviewed
May 20, 2018
| ) as f: | ||
| self.filename = f.name | ||
| for line in self.lines: | ||
| f.write(line.encode(r'utf8')) |
Owner
There was a problem hiding this comment.
line.encode() here might fail exactly like the f.write() line above.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.