[Python-Dev] deleting setdefaultencoding iin site.py is evil

Chris Withers chris at simplistix.co.uk
Thu Aug 27 01:51:51 CEST 2009

exarkun at twistedmatrix.com wrote:
> The ability to change the default encoding is a misfeature.  There's 
> essentially no way to write correct Python code in the presence of this 
> feature.

How so? If every single piece of text in your project is encoded in a 
superset of ascii (such as utf-8), why would this be a problem?
Even if you were evil/stupid and mixed encodings, surely all you'd get 
is different unicode errors or mayvbe the odd strange character during 

> It may be a major task, but the best thing you can do is find each str 
> and unicode operation in the software you're working with and make them 
> correct with respect to your inputs and outputs.  Flipping a giant 
> switch for the entire process is just going to change which things are 
> wrong.

Well, flipping that giant switch has worked in production for the past 5 
years, so I'm afraid I'll respectfully disagree. I'd suspect the 
pragmatics of real world software are with that function even exists, 
and it's extremely useful when used correctly...


Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk

More information about the Python-Dev mailing list