Reputation: 93
Traceback (most recent call last):
File "D:/Program Files/PyCharm/Projects/test.py", line 134, in <module>
text_file.write(text)
UnicodeEncodeError: 'gbk' codec can't encode character '\xa0' in position 2538: illegal multibyte sequence
So basicly this was the error I met when I tried to run a code sample. My OS is not English version, which means the OS Unicode setting is the main cause.
I'm seeking an alternative solution to avoid these kinds of errors in PyCharm. Is there any Unicode setting in PyCharm that I can change? So I can run this code sample at my Laptop without changing the OS Unicode setting?
Upvotes: 0
Views: 614
Reputation: 353
Have you checked here?
According to PyCharm Documentation, you can set a default encoding and set it by project.
Upvotes: 1