There has been some discussion of the merits or demerits/evilness of using sys.setdefaultencoding(...) in python 2.x I'm using PyDev and I want to have the default 'out of the box' python behaviour (US-ASCII as default (non-)encoding), as I feel this is safer (I don't like the site_customize.py approach), even if more laborious.
When I'm using PyDev (particularly for running unittests) it be defaults calls sys.setdefaultencoding('UTF-8'). Other answers have recommended changing the encoding setting to 'US-ASCII' in each 'run configurations' Common tab.
I would like to change the default for all run configurations to 'US-ASCII' across pydev (per workspace) or at least globally for one Python interpreter. Is there a way to do this?
Having looked into the implementation: Pydev uses a PYDEV_CONSOLE_ENCODING environment variable to get the encoding (this is within the site_customize.py file in the org.python.pydev plugin). However this seems to be set from the setting of the run-dialog in the Run configurations drop down. The default says "inherited - UTF-8" but I haven't found anywhere to change this in pydev's settings. I've tried setting the environment variable PYDEV_CONSOLE_ENCODING in various places, but this hasn't got through to site_customize.py (instead it reads the value from the Encoding setting on the dialog tab).
You can change the default encoding at window > preferences > general > workspace > text file encoding (set it to other > us-ascii).