= even more encoding=

Description

Some (at least me :) are working with a different default-encoding than "ASCII". I am using Latin-1, which solves 98% of encoding problems when dealing with Windows-Applications on a German Windows.

so in site.py I changed from ASCII to LATIN-1

Problem

When an application is py2exed, site.py is not available and not parsed. (and that is good)

So the behaviour of the py2exed and the python filename.py use of the application is quite different.

Solution

Top of the application I start with

   1 import sys
   2 if hasattr(sys,"setdefaultencoding"):
   3     sys.setdefaultencoding("latin-1")

Explanation

if site.py is run, it kills the "setdefaultencoding" attribute.

HAM20040806 - we need a ternary decorator