[JDEV] jabber.py problems

Jacek Konieczny jajcus at bnet.pl
Thu Feb 7 10:10:53 CST 2002


On Thu, Feb 07, 2002 at 01:15:45AM +0000, mallum wrote:
> Hmm, thanks for the work on the patch, I'll take a look at it later.
> 
> But Im a little dubious as apart from yuo saying it poor quality and
> the fact that the dreaded "ordinal not in range" *may still* occur
That's because I dind't check everything. I am not able to do it now.
But fix for any such error is just to user proper unicode() or
string.encode().

> I cant really see it as a proper fix. 
The problem is I don't have time to hack it properly. But I would like 
to see jabber.py work as I think it should work. I will need it probably
in near future.

> Id really like to understand what the problem is with changing
> site.encoding which seems to me the most logical and easiest way to
> fix things 100% . 
But "ascii" is the default system encoding in python. And the need to
change it to something else for some module or application doesn't seem
wise to me.
When I wrote one of my python programs I thought the only logical value
for site.encoding is the default locale encoding. And this was the
requirement for my program to work. Then someone convinced me, that this
is bad. And jabber.py problem is very similar to this.

1. What if some other application requires this set to "uft-16" or
"iso-8859-2", or to locale charset (as my program did). If one module
may have some requirements on it, why other should not?

2. System encoding is the encoding used for various output, AFAIK also
for exceptions etc. When it is set to utf-8 some unprintable or even
control character may be sent to the terminal. It would be very bad.

3. XML content is Unicode. UTF-8 is just encoding for starage and
transfer. In applications it should be treated as Unicode, not ascii
string.

> It seems however you fix things in jabberpy the python expat bindings
> will still barf unless you change site.encoding .


> Its probably best to discuss this further ( if you want ) on the
> jabber.py list.
OK, this one goes there too. And this is EOT here.

Greets,
        Jacek



More information about the JDev mailing list