terminal: Incorrect content copied from terminal (Japanese Toothpaste?)
Windows Terminal version
1.17.1023
Windows build number
10.0.19044.0
Other Software
tmux 3.0a
$ cat ~/.tmux.conf| without_comments
set -g default-shell /usr/bin/zsh
bind S source-file ~/.tmux/bastion-quad
set -g default-terminal "tmux-256color"
set -g history-file ~/.tmux_history
set -g history-limit 150000
set-environment -g 'IGNOREEOF' 10
set -g prefix `
unbind -n C-l
unbind -n C-t
unbind -n C-u
unbind -n C-y
unbind -n C-d
unbind -n C-b
unbind C-d
bind ` send-prefix
bind r source-file ~/.tmux.conf \; display "Tmux config reloaded"
bind c new-window -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind = split-window -h -c "#{pane_current_path}"
bind -n C-S-Left swap-window -t -1\; select-window -t -1
bind -n C-S-Right swap-window -t +1\; select-window -t +1
bind -n C-o select-pane -t :.+
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
bind-key X set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
setw -g mouse on
setw -g automatic-rename off
set-window-option -g mode-style bg=colour25,fg=colour254
set -g pane-border-style fg=colour28
set -g pane-active-border-style bg=default,fg=colour98
set -g status-justify centre # center window list for clarity
set-option -g status-position top # position the status bar at top of screen
setw -g monitor-activity off
set -g visual-activity off
set -g status-style bg=colour28,fg=default
set -g window-status-style fg=colour7
set -g window-status-current-style fg=colour1,bg=colour7
bind m run "tmux new -d -s second; tmux movew -t second;"
bind M run "tmux movew -t base;"
set -g status-interval 300
set -g status-right-length 60
set -g status-right "#[fg=colour73] %d %b %Y %l:%M %p"
set -g @override_copy_command 'clip.exe'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
run '~/.tmux/plugins/tpm/tpm'
Hereās terminalās interaction settings
Steps to reproduce
This seems to only be an issue in TMUX⦠however Iāve tested this in the current stable terminal version of 1.16.10261.0
and it is not a problem
try to copy the text sl iam token refresh
. You have to be careful not to get any pre or post characters.
- as far as I can tell, the terminal colouring has no effect on this
empty clipboard
selecting text to copy
Japanese text copied to clipboard
selecting text to copy - with additional text at beginning
proper text copied to clipboard
Expected Behavior
copy text sl iam token refresh
into clipboard
Actual Behavior
copies out text ę±³ę¤ ęµ”ē ęÆę¹„ē ę„ę²ę”³
which when pasted into google translate, is apparently Japanese for toothpaste
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 24 (11 by maintainers)
Absolutely š
Okay, so Iāve got some good news and some bad news.
This is one of the amazing strings that triggers a Windows function called
IsTextUnicode
to go haywire. Check this out.is_unicode.cpp
output
So, the thing about
IsTextUnicode
is that it makes guesses. Literally! The text is otherwise totally unencoded, so it looks like it might actually be Unicode.clip
puts it on the clipboard as a Unicode stringā¦Now, if we manually convert
sl iam token refresh
from UTF-16 to UTF-8, we getā¦toothpaste
This all tickled a memory. If youāre interested in following along with me, it looks like Notepad used to have the same problem. Hereās why:
this is by far the best issue on our repo
Nevermind, I can totally repro this. What on earth? Maybe we can fix clipā¦
wat
hahaha, itās the ghost of clippy š coming back to haunt us!
What on earthā¦! This is amazing!
It looks like youāre using tmuxā copy mode. Would you be able to grab us a trace of whatās coming out of tmux by using the Debug Tap?