Back

Explore Courses Blog Tutorials Interview Questions
0 votes
5 views
in Python by (16.4k points)

I have many "can't encode" and "can't decipher" issues with Python when I execute my applications from the console. Yet, in the Eclipse PyDev IDE, the original (default) character encoding is set to UTF-8, and I'm fine. 

I looked around for setting the default encoding, and individuals say that Python erases the sys.setdefaultencoding capacity on startup, and we can not utilize it.

Is there any best solution?

1 Answer

0 votes
by (26.4k points)

Here is an easier strategy (hack) that gives you back the setdefaultencoding() work that was erased from sys:

import sys

# sys.setdefaultencoding() does not exist, here!

reload(sys)  # Reload does the trick!

sys.setdefaultencoding('UTF8')

Want to become a expert in Python? Join the python course fast!

Related questions

0 votes
1 answer
asked Sep 27, 2019 in AWS by yuvraj (19.1k points)
0 votes
1 answer
asked Mar 31, 2021 in Java by dante07 (13.1k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...