CheckFile raises UnicodeDecodeError
latest build, python 3.3.3, windows 8.1 Pressing Ctrl+Shift+C invokes CheckFile. When the file being checked contains 0x90 UnicodeDecodeError: ... can't decode byte 0x90 ... is raised.
In the traceback I see: File "C:\Python33\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 467, in CheckFile code = f.read() + "\n"
Reported by: ramrom
Original Ticket: pywin32/bugs/667
I added encoding='utf-8' to the open for that file. The program now runs without error.
How do I submit a patch for it?
Original comment by: ramrom
That's only going to work for files that actually are utf-8. If you open it in binary mode, the compile function should decode it acccording to the encoding declaration at the top of the file.
To create a patch, you'll need a program that can produce a unified diff. (http://gnuwin32.sourceforge.net/packages/diffutils.htm is one such)
Original comment by: rupole
This would probably end up fixing itself in Python 3.15+ due to PEP 686 – Make UTF-8 mode default