Encoding error when debugging


I'm having problems debugging some python 3 code. The error is related with a wrong encoding set by the debugger when reading the file being debugged.

I don't know what to do as the encoding is rightly set inside the editor (it says"utf-8"). I have also tested the encoding in other editors and it is correct.

I don't know if this is a bug or a misconfiguration. But to reproduce it:

  1. create an empty project
  2. set the interpreter to python3
  3. create a python file
  4. set the encoding to utf-8 if not alredy set by default
  5. write print("Á")
  6. hit debug

C:\Python31\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 1.1.1\helpers\pydev\pydevd.py" --client --port 56853 --file "C:/test.py"

Connected to pydev debugger (build 101.15)

pydev debugger: starting

Traceback (most recent call last):

  File "C:\Program Files (x86)\JetBrains\PyCharm 1.1.1\helpers\pydev\pydevd.py", line 1165, in <module>

    debugger.run(setup['file'], None, None)

  File "C:\Program Files (x86)\JetBrains\PyCharm 1.1.1\helpers\pydev\pydevd.py", line 936, in run

    line = stream.readline() #Should not raise an exception even if there are no more contents

  File "C:\Python31\lib\encodings\cp1252.py", line 23, in decode

    return codecs.charmap_decode(input,self.errors,decoding_table)[0]

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 8: character maps to <undefined>

This is VERY ANNOYING. What could I do?

System details: PyCharm 1.1.1, Python 3.1.3, Windows 7

Please sign in to leave a comment.