Skip to content

test_utils.py header and data encoding mismatch  #22

@CarlFK

Description

@CarlFK

top line is:

# -*- coding: utf-8 -*-

https://github.com/dabodev/dabo/blob/master/dabo/lib/test/test_utils.py#L1

but the bytes appear to be windows-1250

carl@twist:~/temp$ python 
Python 2.7.10 (default, Oct 14 2015, 16:09:02) 
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> b = open('dabo/dabo/lib/test/test_utils.py').read()
>>> s = b.decode('utf-8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x8e in position 1183: invalid start byte
>>> s = b.decode('windows-1250')

This mismatch is causing 2to3 to error:

carl@twist:~/temp$ 2to3 dabo/dabo/lib/test/test_utils.py
UnicodeDecodeError: 'utf8' codec can't decode byte 0x8e in position 1183: invalid start byte

changing the top line and no error.

2to3 seems to respect the header.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions