[Twisted-Python] twisted xmpp-router component interface problem

Ralph Meijer twisted at ralphm.ik.nu
Wed Mar 3 16:25:56 EST 2010

On Wed, 2010-03-03 at 14:32 -0500, Drew Smathers wrote:
> On Wed, Mar 3, 2010 at 1:56 PM, Werner Thie <wthie at thiengineering.ch>
> wrote:
> [..]
>         After some fiddling around it seems that the code at line 282
>         in
>         twisted\words\protocols\jabber\xmlstream.py presets the sid of
>         the
>         stream to a str instead of a unicode(str).

Yes, this is a problem I noticed the other day as well. A ticket,
assigned to me, is in order.

> Just out of curiosity, I did look at xmlstream and the whole unicode
> type checking seems unnecessary considering how the values are used:
> input = u"%s%s" % (sid, password)
> Why sid and password have to be unicode objects and not just
> basestring beats me.

For the gory details, see http://twistedmatrix.com/trac/ticket/3847. The
short version is that digest authentication requires UTF-8 encoded input
and GTK sets Python's default encoding to UTF-8. Before these checks,
using non-ASCII characters in passwords would fail in some cases. As
both the session id and password can use the full range of unicode, it
makes sense to require that explicitly.


More information about the Twisted-Python mailing list