Skip to content

console_to_str: ignore invalid utf-8 #70

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 1 commit into from
Sep 2, 2017

Conversation

trnila
Copy link
Contributor

@trnila trnila commented Sep 2, 2017

When tmux window title contains invalid utf-8 sequence, libtmux throws exception, for example:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 9: invalid start byte

This can be archieved with accidentaly cating binary data to stdout or with

$ printf '\033k;\x96\033\'

This issue seems to be fixed in tmux (tmux/tmux@8149bc3) - title is set only if it is valid utf-8.

Could we fix this issue by ignoring invalid utf-8 sequences directly in function console_to_str?

@codecov-io
Copy link

codecov-io commented Sep 2, 2017

Codecov Report

Merging #70 into master will decrease coverage by 0.35%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #70      +/-   ##
==========================================
- Coverage   79.71%   79.36%   -0.36%     
==========================================
  Files           8        8              
  Lines         848      848              
==========================================
- Hits          676      673       -3     
- Misses        172      175       +3
Impacted Files Coverage Δ
libtmux/window.py 82.38% <0%> (-0.63%) ⬇️
libtmux/session.py 80.48% <0%> (-0.61%) ⬇️
libtmux/common.py 85.85% <0%> (-0.51%) ⬇️

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 d9a84dd...f9c743e. Read the comment docs.

@tony tony merged commit 90592de into tmux-python:master Sep 2, 2017
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