Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix for unicode commands in Python 2 #131

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

Merged
merged 3 commits into from
Jan 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions 6 libtmux/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,9 @@ def reraise(tp, value, tb=None):


number_types = integer_types + (float,)

def str_from_console(s):
try:
return text_type(s)
except UnicodeDecodeError:
return text_type(s, encoding='utf_8')
4 changes: 2 additions & 2 deletions 4 libtmux/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from distutils.version import LooseVersion

from . import exc
from ._compat import console_to_str
from ._compat import console_to_str, str_from_console

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -196,7 +196,7 @@ def __init__(self, *args, **kwargs):

cmd = [tmux_bin]
cmd += args # add the command arguments to cmd
cmd = [str(c) for c in cmd]
cmd = [str_from_console(c) for c in cmd]

self.cmd = cmd

Expand Down
4 changes: 4 additions & 0 deletions 4 tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ def test_tmux_cmd_raises_on_not_found():
tmux_cmd('-V')


def test_tmux_cmd_unicode():
tmux_cmd('new-window', '-t', 3, '-n', 'юникод', '-F', u'Ελληνικά')


@pytest.mark.parametrize(
"session_name,raises,exc_msg_regex",
[
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.