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

Detect target file encoding in autodetect.py #71

Merged
merged 1 commit into from
Dec 5, 2014
Merged

Detect target file encoding in autodetect.py #71

merged 1 commit into from
Dec 5, 2014

Commits on Nov 20, 2014

  1. Detect target file encoding in autodetect.py

    Closes issue #65.  Infer the target python source
    file encoding before attempting to parse it for
    imports of interest.
    
    - First, using byte order markers (BOM).  An example of
      this was found in ``setuptools/tests/script-with-bom.py``.
    - Secondly, using PEP263 regular expression over the first
      two lines -- only if they begin with a comment (#), decoded
      as utf8, to determine if it has a source file encoding,
      by seeking statements such as ``# coding: latin1``.
    - Finally, default to utf8.  If the target file fails to decode,
      or the given codec is not found -- issue a warning and move
      on to the next file.
    jquast committed Nov 20, 2014
    Configuration menu
    Copy the full SHA
    81d4624 View commit details
    Browse the repository at this point in the history