romanofski / programslice

Static analysis tool to slice python programs
GNU General Public License v3.0
36 stars 7 forks source link

Encoding issues when parsing source code #7

Closed romanofski closed 12 years ago

romanofski commented 12 years ago

I'm still running into encoding issues when parsing the source. Simply open the setup.py of programslice in vim and slice it. You get:

Error detected while processing function <SNR>36_slice_buffer:
line   14:
Traceback (most recent call last):
  File "<string>", line 10, in <module>
  File "/opt/works/vim/ftplugin/python/programslice/__init__.py", line 76, in slice_string
    node = ast.parse(source.decode(encoding), name)
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 263: ordinal not in range(128)