pythoscope
pythoscope copied to clipboard
fix Unicode error
I don't think this is the right solution. Please see http://stackoverflow.com/questions/3828723/why-should-we-not-use-sys-setdefaultencodingutf-8-in-a-py-script Using unicode()
in place of str()
and using .decode('utf-8')
where applicable is a better solution.
@mkwiatkowski you can check the second answer for this question http://stackoverflow.com/questions/28657010/dangers-of-sys-setdefaultencodingutf-8
Setting the defaultencoding to UTF-8 nowadays is safe, except for specialised applications, handling files from non unicode ready systems.
The "official" rejection of the switch is based on reasons no longer relevant for a vast majority of end users (not library providers), so we should stop discouraging users to set it.
I don't agree with the reasoning presented in the stack overflow post you linked. Anyway, since there is only one place in code where this is needed, using decode
here will be shorter than putting reload
+setdefaultencoding
in three different files.