pythoscope icon indicating copy to clipboard operation
pythoscope copied to clipboard

fix Unicode error

Open atlasoracle-dev opened this issue 8 years ago • 3 comments

atlasoracle-dev avatar Nov 12 '16 13:11 atlasoracle-dev

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 avatar Nov 14 '16 16:11 mkwiatkowski

@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.

atlasoracle-dev avatar Nov 14 '16 23:11 atlasoracle-dev

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.

mkwiatkowski avatar Nov 15 '16 08:11 mkwiatkowski