Xpra: Ticket #2353: Character encoding problem when connecting to server

Using xpra 2.5.2+dfsg1-2 (currently in Debian unstable), also tested 2.5.2-r22875-1.

Connection to server is impossible, server reports:

Error: processing new connection from Protocol(unix-domain socket:/run/xpra/hostname-100):
 'latin-1' codec can't encode characters in position 0-6: ordinal not in range(256)
Disconnecting client Protocol(unix-domain socket:/run/xpra/hostname-100):

2.4.3 works fine

custom configuration, aside from key shortcuts and vars:

pulseaudio = no
dpi = 96
desktop-scaling = on
xsettings = no
start-new-commands = yes


Thu, 04 Jul 2019 17:31:01 GMT - Antoine Martin: owner changed

Please post the server's -d server debug log output.


Thu, 04 Jul 2019 17:39:58 GMT - psycho_zs: attachment set

server log


Thu, 04 Jul 2019 17:45:02 GMT - Antoine Martin: owner, status changed

Thanks, this comes from:

b'desktop.names': (b'\xd1\x80\xd0\xb0\xd0\xb1\xd0\xbe\xd1\x87\xd0\xb8\xd0\xb9 \xd1\x81\xd1\x82\xd0\xbe\xd0\xbb 1', b'\xd1\x80\xd0\xb0\xd0\xb1\xd0\xbe\xd1\x87\xd0\xb8\xd0\xb9 \xd1\x81\xd1\x82\xd0\xbe\xd0\xbb 2', b'\xd1\x80\xd0\xb0\xd0\xb1\xd0\xbe\xd1\x87\xd0\xb8\xd0\xb9 \xd1\x81\xd1\x82\xd0\xbe\xd0\xbb 3', b'\xd1\x80\xd0\xb0\xd0\xb1\xd0\xbe\xd1\x87\xd0\xb8\xd0\xb9 \xd1\x81\xd1\x82\xd0\xbe\xd0\xbb 4', b'\xd1\x80\xd0\xb0\xd0\xb1\xd0\xbe\xd1\x87\xd0\xb8\xd0\xb9 \xd1\x81\xd1\x82\xd0\xbe\xd0\xbb 5'

And this line:

v = strtobytes(dn).decode("utf8")

That's odd because this code has not changed? Maybe you've switched to python3?

Those strings look wrong, not sure how to interpret them.


Thu, 04 Jul 2019 17:46:34 GMT - Antoine Martin:

Oh, I think I get it, it's the stricter exception checking: we need to catch UnicodeEncodeError.


Thu, 04 Jul 2019 17:48:04 GMT - psycho_zs:

These are just default localized names of desktops in Openbox: "рабочий стол #"


Thu, 04 Jul 2019 17:48:49 GMT - Antoine Martin:

Can you paste the output of:

./xpra/platform/gui.py  | grep -i desktop

Thu, 04 Jul 2019 17:50:31 GMT - psycho_zs:

def get_number_of_desktops():
def get_desktop_names():
def show_desktop(show):
            "desktops"                      : get_number_of_desktops(),
            "desktop_names"                 : get_desktop_names(),
                "show_desktop", "set_fullscreen_monitors", "set_shaded",
                "get_number_of_desktops", "get_desktop_names",

Thu, 04 Jul 2019 17:51:27 GMT - Antoine Martin:

You have to run the exact command, not grep the source.


Thu, 04 Jul 2019 17:56:13 GMT - psycho_zs:

Oh. this file is not executable and can not find xpra.platform module if run in python.


Thu, 04 Jul 2019 17:57:24 GMT - Antoine Martin:

this file is not executable

This should work:

python2 /path/to/xpra/platform/gui.py  | grep -i desktop

and / or:

python3 /path/to/xpra/platform/gui.py  | grep -i desktop

Thu, 04 Jul 2019 18:00:53 GMT - psycho_zs:

Right, python3, missed that in the path.

$ python3 /usr/lib/python3/dist-packages/xpra/platform/gui.py | grep -i desktop
* desktop_names                   : рабочий стол 1, рабочий стол 2, рабочий стол 3, рабочий стол 4, рабочий стол 5
* desktops                        : 5

Thu, 04 Jul 2019 18:02:23 GMT - Antoine Martin:

Thanks, I should be able to come up with a proper fix now.

In the meantime, r23099 should workaround the problem, you can apply it by hand.


Thu, 04 Jul 2019 18:07:43 GMT - psycho_zs:

The workaround works, thanks!


Thu, 04 Jul 2019 21:00:37 GMT - Antoine Martin: status changed; resolution set

More correct fix in r23100. (will backport)


Sat, 23 Jan 2021 05:49:01 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2353