Gustavo Niemeyer <niemeyer@conectiva.com> writes: > Will "print s.encode('iso-8859-1')" work for everybody? If not, how is > it better than doing it implicitly in site.py? It won't work for everybody: it will only work if the terminal's (*) encoding is latin-1. For printing to the terminal, using the locale's encoding is a good guess (**). That does not mean the default encoding should be changed - if you change it, it would apply also to other Unicode/byte string conversions, in places that doesn't have to do with the locale's encoding. That's why it is a bad idea to change the default encoding. Instead, there should be a convenient way to obtain the terminal's encoding. Unfortunately, this is impossible to implement in the general case. Regards, Martin (*) this assumes that print goes to the terminal. If it goes to some other stream, the definition of "will work" changes. (**) there are still cases where it won't work. E.g. in a Windows cmd.exe window, the OEM code page should be used, whereas the locale's encoding would be the ANSI code page.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4