line 636 of protocol/rq.py checks if type(val) is
types.StringType. This means that unicode strings end
up getting treated as integers. A good replacement for
that line would be:
if isinstance(val, types.StringTypes)
This will catch plain str's as well as unicode strings.
To reproduce:
from Xlib import display
dpy = display.Display()
win = dpy.screen().root.create_window(0, 0, 1, 1, 0,
X.CopyFromParent)
props.change_prop(dpy, win,
dpy.intern_atom('_NET_WM_NAME'), u'hey guy')
take the u off and it works fine.
Logged In: YES
user_id=653631
Oops, I screwed that example up a little.
from Xlib import display
dpy = display.Display()
win = dpy.screen().root.create_window(0, 0, 1, 1, 0,
X.CopyFromParent)
win.change_property(dpy.intern_atom('_NET_WM_NAME'),
dpy.intern_atom('UTF8_STRING'), 8, u'hey guy')
Logged In: YES
user_id=68375
But that would require that Python Xlib assumes that all
unicode strings should be sent as UTF-8 strings to the
server. I don't think that is necessary valid.
Can't you just convert the string explicitly to utf-8, since
you say that you are going to store it? If anything should
be added, I think that would be a utility method
change_utf8_property(atom, string) which always uses
UTF8_STRING and UTF-8-converts whatever gets sent in.