mkwiatkowski / pythoscope

unit test generator for Python
http://pythoscope.wikidot.com
MIT License
96 stars 26 forks source link

fix Unicode error #12

Open harrypotterismyname opened 7 years ago

mkwiatkowski commented 7 years ago

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.

harrypotterismyname commented 7 years ago

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

mkwiatkowski commented 7 years ago

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.