X Tutup
The Wayback Machine - https://web.archive.org/web/20210106130908/https://github.com/python-xlib/python-xlib/issues/103
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`Window.get_wm_name` does not handle Unicode values #103

Open
tomkcook opened this issue Feb 8, 2018 · 1 comment
Open

`Window.get_wm_name` does not handle Unicode values #103

tomkcook opened this issue Feb 8, 2018 · 1 comment
Labels

Comments

@tomkcook
Copy link

@tomkcook tomkcook commented Feb 8, 2018

I'm using Python 3 and current PyPI version of Xlib.

When I call get_wm_name() on a window that has non-ASCII characters in the name, b'' is returned. I've traced this down as far as drawable.get_property and confirmed that the value returned from the request there is also b''.

@benoit-pierre
Copy link
Member

@benoit-pierre benoit-pierre commented Feb 9, 2018

get_wm_name defaults to using the STRING type. There are 3 string types: STRING, UTF8_STRING, and COMPOUND_TEXT. Depending on how the name was set, you could try:

window.get_full_text_property(Xatom.WM_NAME, display.get_atom('UTF8_STRING'))

This should return a proper Unicode string if the property was set with UTF8_STRING. xterm -title, for example, will use COMPOUND_TEXT, which is unsupported: you'll get the raw bytes, not a decoded Unicode string (more info here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.
X Tutup