Duckapple / Kat

Kattis shell for getting examples, testing and submitting.
18 stars 6 forks source link

Exception: "'utf-8' codec can't decode byte 0xe5 in position 23: invalid continuation byte" #76

Open davidsule opened 2 years ago

davidsule commented 2 years ago

Can't handle special characters in print() statement, throws the above exception (I tried with the Danish 'å' letter.)

In addition, at submission, because of the issue, it replaces the special characters with others, producing a 'Wrong answer' result.

Traceback (most recent call last):
  File "C:\Users\path\to\Kat-master\kattis.py", line 40, in main
    execCommand[command](data)
  File "C:\Users\path\to\Kat-master\commands\test.py", line 57, in testCommand
    result, time = runSingleTest(command, directory, inF, ansF)
  File "C:\Users\path\to\Kat-master\commands\test.py", line 107, in runSingleTest
    subprocess.run(command, stdout=subprocess.PIPE, input=inp, cwd=directory)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe5 in position 23: invalid continuation byte
davidsule commented 2 years ago

Update: this error happened on Windows, on Mac it seems to work (I haven't tried Linux - I have a problem with the program on WSL but the issue there is probably on my side - however, my guess it that it would work on Linux).

Duckapple commented 2 years ago

Can you check the encoding of the source file? (e.g. by checking your status bar at the bottom in VS Code)

davidsule commented 2 years ago

It's UTF-8