Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
davidsule opened this issue Sep 13, 2021 · 3 comments

Comments

@davidsule
Copy link

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
Copy link
Author

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
Copy link
Owner

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

@davidsule
Copy link
Author

It's UTF-8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants