As of python3.5.1 this hack looks like this:
import _locale
_locale._getdefaultlocale = (lambda *args: ['en_US', 'utf8'])
All files opened thereafter will assume the default encoding to be utf8
.
More Related Contents:
- Why doesn’t Python recognize my utf-8 encoded source file?
- Should I use encoding declaration in Python 3?
- Python 3 CSV file giving UnicodeDecodeError: ‘utf-8’ codec can’t decode byte error when I print
- How do you fix “runtimeError: package fails to pass a sanity check” for numpy and pandas?
- Working with UTF-8 encoding in Python source [duplicate]
- PermissionError: [Errno 13] Permission denied
- error UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xff in position 0: invalid start byte
- Windows cmd encoding change causes Python crash
- Can I install Python 3.x and 2.x on the same Windows computer?
- How to convert a file to utf-8 in Python?
- python ctypes issue on different OSes
- How do I check if a string is unicode or ascii?
- No module named ‘pandas._libs.tslibs.timedeltas’ in PyInstaller
- How to install pip3 on Windows?
- How to write UTF-8 in a CSV file
- tkinter.TclError: image “pyimage3” doesn’t exist
- Python 3 print() function with Farsi/Arabic characters [duplicate]
- portable way to write csv file in python 2 or python 3
- Python 3: How to specify stdin encoding
- Microsoft Visual C++ Compiler for Python 3.4
- How to run different python versions in cmd [duplicate]
- How can I add python to cmd in windows [closed]
- python 3 open() default encoding
- Why does this Python program send empty emails when I encode it with utf-8? [duplicate]
- What encoding does open() use by default?
- python encoding utf-8
- Python – dealing with mixed-encoding files
- Error: No module named ‘fcntl’
- UnicodeDecodeError when performing os.walk
- How to calculate length of string in pixels for specific font and size?