X Tutup
The Wayback Machine - https://web.archive.org/web/20210106130729/https://github.com/python-xlib/python-xlib/pull/52
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

Fix properties handling #52

Merged

Conversation

@benoit-pierre
Copy link
Member

@benoit-pierre benoit-pierre commented Aug 2, 2016

With the support for Python 3 we started automatically encoding/decoding 8-bits string properties. This is a mistake, as some properties are binary, and those that are actual text may use different encodings. This PR revert the change: bytes are expected on input and returned on output.

FWIU, there are 3 types of text properties:

  • STRING for ISO-8859-1 encoded strings
  • UTF8_STRING for UTF-8 encoded strings
  • and COMPOUND_TEXT for ISO/IEC 2022 encoded strings

This PR add 2 convenience helpers for dealing with text properties: change_text_property and get_full_text_property, with automatic encoding/decoding for STRING and UTF8_STRING.

Those are automatically used for setting/getting wm_name, wm_icon_name, wm_class and wm_client_machine.

Additionally I fixed examples/get_selection.py encoding handling.

This fix #48.

Stick to byte strings as a property value can be binary data even
when using an X11 8-bits string.
Avoid redefining 'type' builtin.
@codecov-io
Copy link

@codecov-io codecov-io commented Aug 2, 2016

Current coverage is 81.20% (diff: 25.64%)

Merging #52 into master will decrease coverage by 0.07%

@@             master        #52   diff @@
==========================================
  Files            39         39          
  Lines          4382       4390     +8   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           3562       3565     +3   
- Misses          820        825     +5   
  Partials          0          0          

Powered by Codecov. Last update e47dadf...e76296e

@vasily-v-ryabov vasily-v-ryabov merged commit a193442 into python-xlib:master Aug 2, 2016
4 checks passed
4 checks passed
QuantifiedCode 2 minor issues introduced.
Details
code-quality/landscape Code quality increased by 0.02%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
semaphoreci The build passed on Semaphore.
Details
@benoit-pierre benoit-pierre deleted the benoit-pierre:fix_properties_handling branch Aug 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

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