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

work on file encoding detection #883

Merged
merged 4 commits into from
Mar 8, 2019
Merged

work on file encoding detection #883

merged 4 commits into from
Mar 8, 2019

Conversation

bcroq
Copy link

@bcroq bcroq commented Mar 6, 2019

Here is a proposed patch for #842 that works on Python 2 and Python 3.
Tested with a UTF-8 encoded file and a latin-9 encoded file:

$ isort - < test_utf8.py && echo ok
# coding: utf-8

x = 'testé'
ok
$ isort - < test_latin9.py && echo ok
# coding: latin9

x = 'testé'
ok
$ isort test_utf8.py && echo ok
ok
$ isort test_latin9.py && echo ok
ok

Also tested with flake8-isort:

$ flake8 --no-isort-config test_utf8.py && echo ok
ok
$ flake8 --no-isort-config test_latin9.py && echo ok
ok

@timothycrosley
Copy link
Member

This looks great, thank you!

@timothycrosley timothycrosley merged commit 6655b28 into PyCQA:master Mar 8, 2019
@bcroq bcroq deleted the file-encoding branch March 11, 2019 08:05
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