Unicode conversion in 'print'
Serge Orlov
Serge.Orlov at gmail.com
Fri Jan 14 09:18:36 EST 2005
Ricardo Bugalho wrote:
> Hi,
> thanks for the information. But what I was really looking for was
> informaion on when and why Python started doing it (previously, it
> always used sys.getdefaultencoding()))
I don't have access to any other version except 2.2 at the moment but I
believe it happened between 2.2 and 2.3 for Windows and UNIX terminals.
On other unsupported terminals I suspect sys.getdefaultencoding is
still used. The reason for the change is proper support of unicode
input/output.
> and why it was done only for 'print' when
> stdout is a terminal instead of always.
The real question is why not *never* use sys.getdefaultencoding()
for printing. If you leave sys.getdefaultencoding() at Python default
value ('ascii') you won't need to worry about it <wink>
sys.getdefaultencoding() is a temporary measure for big projects to
use within one Python version.
Serge.
More information about the Python-list
mailing list