[Mailman-i18n] sync_members, list_members problem
Barry A. Warsaw
barry@python.org
Mon Dec 2 16:23:10 2002
This is in reference to SF bug # 644005
http://sourceforge.net/tracker/?group_id=103&atid=100103&func=detail&aid=644005
When there are realnames of members with "funny" characters in them,
sync_members and list_members can throw UnicodeError exceptions
because it's trying to print strings with characters ord > 128.
I've implemented a fix to first sys.getdefaultencoding() and then
actually print ustr.encode(enc, 'replace') to stdout. That fixed the
problem for me, but is it the right solution?
On a related note, and I know this has been discussed on python-dev,
is it really not possible to call sys.setdefaultencoding() anywhere in
Python except by hacking site.py? PyUnicode_SetDefaultEncoding()
seems to only be exported to Python via sys, but that is deleted by
site.py after being called once.
This seems quite shortsighted (maybe I should raise this on
python-dev). Say my terminal can handle iso-8859-1. I'd like to be
able to set the default encoding to that somewhere that user-specific,
say PYTHONSTARTUP if I'm running interactively. But that seems
impossible, and I don't think hacking site.py is the appropriate
response. What if someone else at my site uses a different terminal
that can't print iso-8859-1?
-Barry
More information about the Mailman-i18n
mailing list