Re:Moving Away from Python 2
by mark-r on Friday May 20, 2016 @03:42PM
(#11740850)
Yes, it will explode if you try to write a Unicode string to something that doesn't have UTF-8 encoding by default. But it won't explode if you write byte strings, or if your default encoding is UTF-8.
[ Parent
| on HN ]
Windows console is that case which doesn't default to UTF-8. At the time when I was working with it, py2 defaulted to ascii.
For some locales Windows has additional bonus, the Ansi (GUI) encoding is different than OEM (console) and it was heroic undertaking to make your program work correctly for both.
Python3 works out of the box.
I can sympathize, Windows is my environment too. But I'm not blind to other environments where some simplifying assumptions can be made.
For true insanity try adding IDLE to the mix. IDLE under Windows in Python 2 will let you output UTF-8, but won't accept it as input. Python 3 is more consistent.