wistful / SublimeAutoPEP8

Automatically formats Python code to conform to the PEP 8 style guide using autopep8 and pep8 modules
144 stars 23 forks source link

Can't preview/format files with non-ascii characters. #31

Closed wistful closed 9 years ago

wistful commented 9 years ago

Step to reproduce: 1) Open folder with Sublime Text 2) Create new file with text:

#!/usr/bin/env python
# coding=utf-8

DAY_MAP_RU = {
    'Понедельник': 'Monday',
    'Вторник': 'Tuesday',
    'Среда': 'Wednesday',
    'Четверг': 'Thursday',
    'Пятница': 'Friday',
    'Суббота': 'Saturday',
    'Воскресенье': 'Sunday',
}

3) Try to preview/format file using sidebar menu Expected result: preview/format works without any errors Actual result: UnicodeDecodeError

Traceback (most recent call last):
  File "./sublautopep8.py", line 118, in <lambda>
  File "./sublimeautopep8lib/common.py", line 148, in worker

  File "./sublimeautopep8lib/common.py", line 125, in format_source

UnicodeEncodeError: 'ascii' codec can't encode characters in position 58-68: ordinal not in range(128)
wistful commented 9 years ago

Fixed in v1.2