3 ms·
> Python now uses UTF-8 as the default encoding, independent of the system’s environment. Nice, not specifying the encoding is one of the most common issues I
by ruuda 10mo ago
> Python now uses UTF-8 as the default encoding, independent of the system’s environment.
Nice, not specifying the encoding is one of the most common issues I need to point out in code reviews.
- joshribakoff 10mo agoHave you considered reducing review noise by using static analysis?
- formerly_proven 10mo agoencode()/decode() have used UTF-8 as the default since Python 3.2 (soon, 15 years ago). This is about the default encoding for e.g. the "encoding" parameter of open().
- franga2000 10mo agoYou mean the coding= comment? Where are you shipping your code that that was actually a problem? I've never been on a project where we did that, let alone needed it.
- KORraN 10mo agoThe comment you mention applies to source code encoding and it's obsolete for Python 3 since the beginning. This is about something else: https://docs.python.org/3.15/whatsnew/3.15.html#whatsnew315-utf8-default https://docs.python.org/3.15/whatsnew/3.15.html#whatsnew315-...
- franga2000 10mo agoMakes sense, my bad, but even that is something I've never seen. I guess this is mostly a Windows thing? I've luckily never had the misfortune of having to deploy Python code on Windows.
- ruuda 10mo agoIt's a Linux thing too. It bit me in particular when running a script in a container that defaulted to ascii rather than utf-8 locale.