Umlauts revisited: Now they prevent program from running
Michael Hudson
mwh21 at cam.ac.uk
Fri Jan 26 09:57:46 EST 2001
"Franz GEIGER" <fgeiger at datec.at> writes:
> Wow! Both of yours - Alex and Michael - did the trick! Thanks a lot!
Pleasure.
> Is there another trick to switch globally to this encoding? Or do I have to
> check for '\xyz' characters and then encode them?
You can call sys.setdefaultencoding in your sitecustomize.py (you have
to call this function right at the very start of your application so
it's deleted in site.py).
> For now I do a try. If an exception is catched I call the encode method.
It would be better to call the .encode method every time.
> Is this the way doing it _always_ if umlauts could come across my way?
> That'd be cumbersome because the German language is teeming with umlauts
> (o.k., carried it too far ;-))
Probably writing yourself a sitecustomize.py is the way to go.
Cheers,
M.
--
Just point your web browser at http://www.python.org/search/ and
look for "program", "doesn't", "work", or "my". Whenever you find
someone else whose program didn't work, don't do what they
did. Repeat as needed. -- Tim Peters, on python-help, 16 Jun 1998
More information about the Python-list
mailing list