This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mjpieters
Recipients mjpieters, paul.moore, steve.dower, tim.golden, zach.ware
Date 2016-08-19.07:37:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1471592282.81.0.915425823239.issue27797@psf.upfronthosting.co.za>
In-reply-to
Content
To reproduce, create an ASCII file with > io.DEFAULT_BUFFER_SIZE bytes (can be blank lines) and *UNIX line endings*, with the first two lines reading:

  #!/usr/bin/env python
  # -*- coding: cp1252 -*-

Try to run this as a script on Windows:

    C:\Python35\python.exe encoding-problem-cp1252.py
     File "encoding-problem-cp1252.py", line 2
    SyntaxError: encoding problem: cp1252

Converting the file to use CRLF (Windows) line endings makes the problem go away.

This appears to be a fallout from issue #20731.

Demo file that reproduces this issue at 710 bytes: https://github.com/techtonik/testbin/raw/fbb8aec3650b45f690c4febfd621fe5d6892b14a/python/encoding-problem-cp1252.py

First reported by anatoly techtonik at https://stackoverflow.com/questions/39032416/python-3-5-syntaxerror-encoding-prob-em-cp1252
History
Date User Action Args
2016-08-19 07:38:02mjpieterssetrecipients: + mjpieters, paul.moore, tim.golden, zach.ware, steve.dower
2016-08-19 07:38:02mjpieterssetmessageid: <1471592282.81.0.915425823239.issue27797@psf.upfronthosting.co.za>
2016-08-19 07:38:02mjpieterslinkissue27797 messages
2016-08-19 07:37:57mjpieterscreate