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 for unicode commands in Python 2 #131

Merged
merged 3 commits into from
Jan 13, 2019

Conversation

myw
Copy link
Contributor

@myw myw commented Jul 9, 2018

Before this PR, if a command was passed into tmux_command that had unicode characters in it, such as in the name of a session, format string, or window, a unicode error would be thrown when tmuxp was run with Python 2. The provided unit test shows an example failing test case of this behavior—the real-world use-case is config.yml files for tmuxp that contain unicode characters in their names.

This PR resolves the issue by using a python-version-independent conversion inside the tmux_command constructor (instead of str), assuming that unicode data being sent in Python 2 is encoded as utf_8, which is consistent with other places in the code that assumption is made.

Happy to answer any questions, an thanks for making this!

@codecov-io
Copy link

codecov-io commented Jul 9, 2018

Codecov Report

Merging #131 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #131   +/-   ##
=======================================
  Coverage   79.49%   79.49%           
=======================================
  Files           8        8           
  Lines         863      863           
=======================================
  Hits          686      686           
  Misses        177      177
Impacted Files Coverage Δ
libtmux/common.py 86.5% <100%> (ø) ⬆️
libtmux/window.py 83.53% <0%> (ø) ⬆️
libtmux/pane.py 81.81% <0%> (ø) ⬆️
libtmux/server.py 77.9% <0%> (ø) ⬆️
libtmux/session.py 80.12% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 71d25c4...345de45. Read the comment docs.

@myw
Copy link
Contributor Author

myw commented Jul 23, 2018

@tony would you mind taking a look at this?

@tony
Copy link
Member

tony commented Oct 14, 2018

@myw Sorry for the delay, can you do a rebase?

@myw myw force-pushed the fix-unicode-py2-config branch from 0b77906 to 345de45 Compare October 26, 2018 19:39
@myw
Copy link
Contributor Author

myw commented Oct 26, 2018

@tony Rebased! Thanks!

@tony tony merged commit 9097c31 into tmux-python:master Jan 13, 2019
@tony
Copy link
Member

tony commented Jan 13, 2019

@myw Merged! Thanks!

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

Successfully merging this pull request may close these issues.

3 participants