default setting of unicode set

Andreas Kostyrka andreas at
Mon Aug 5 10:38:51 CEST 2002

Am Mon, 2002-07-29 um 16.04 schrieb Boudewijn Rempt:
> This question comes up so often that I'm more and more convinced that
> the argument for deleting sys.setdefaultencoding() is flawed. Calling
My opinion too. It especially hurts porting applications from pre
Unicode Pythons. And there is no Tkinter.codec_open for all the
interwoven GUI stuff. So it's either going over tens of KLOCs or using
a default encoding. And in this special case (as it is a specialized
application), the application knows the sensible default encoding. Not
the system, not the user.
> sys.setdefaultencoding("utf-8"), _is_ rather explicit, and beats having to 
> add .encode()'s to all string handling. There exists a class of application 
> that want to use unicode irrespective of any settings the user might have 
> decided upon(1).
> My default way of coding around this inconvenience is to add a 
> file that saves the setdefaultencoding under another
> name, like setappdefaultencoding().
Why not make your file read a .pythonrc file? :)


More information about the Python-list mailing list