#667 CheckFile raises UnicodeDecodeError

v1.0 (example)
open
nobody
None
5
2014-03-31
2014-03-31
bob gailer
No

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"

Discussion

  • bob gailer
    bob gailer
    2014-03-31

    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?

     
    • Roger Upole
      Roger Upole
      2014-04-03

      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)