If you are working in docker and have utf8 problems like
#python #encoding #utf8 #encode #decode
UnicodeDecodeError
exceptions. And you are scratching your head like me and encode
& decode
does no good for the problem, use setdefaultencoding
:import sys
reload(sys)
sys.setdefaultencoding("utf-8")
NOTE:
it is discouraged to use the above function. As I have mentioned docker which its OS is isolated, I aware of what I'm doing. In case you are in doubt DO NOT USE IT specially on host OS!#python #encoding #utf8 #encode #decode