You are not logged in.

#1 2013-12-21 19:57:09

never2far
Member
Registered: 2013-12-21
Posts: 5

[SOLVED] Weird characters while pasting in terminal

Hello,

When I'm trying to paste a text using Shift + Insert in terminal i'll get weird characters. For example if i'll copy word "test" and then paste it, in the terminal i'll get "0~test1~"

I have tried to paste the word in a text editor (vim) and there everything is okay. I have also tried to use another shell (currently i'm using bash) but i'm still having problems sad


Please help me with some ideas in order to better understand what is causing this and maybe i will find a way to fix it.

Thank you

Last edited by never2far (2013-12-21 23:18:22)

Offline

#2 2013-12-21 20:01:17

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Weird characters while pasting in terminal

How are you copying, and what, to the system clipboard? What terminal are you using?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2013-12-21 20:04:50

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Weird characters while pasting in terminal

Works fine here: select 'text' by pressing and holding LMB, go the urxvt with bash and press Shift+Insert.

Offline

#4 2013-12-21 21:34:04

never2far
Member
Registered: 2013-12-21
Posts: 5

Re: [SOLVED] Weird characters while pasting in terminal

jasonwryan wrote:

How are you copying, and what, to the system clipboard? What terminal are you using?


I'm copying text using mouse by dragging over a text (the situation is the same on any text) and then Ctrl + Shift + C and to paste ctrl + insert or Ctrl + Shift + V

[root@desk ~]# arch  (after selecting text arch on the next line you will see the exact text that i see after Shift + insert)

[root@desk ~]# 0~arch1~

Offline

#5 2013-12-21 22:10:15

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Weird characters while pasting in terminal

Is the Ctrl-Shift-c and Ctrl-Shift-v something that your desktop environment manages, because it is not native to the clipboard. As karol says, select the text and then Shift-Insert to paste into a terminal.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2013-12-21 22:38:56

never2far
Member
Registered: 2013-12-21
Posts: 5

Re: [SOLVED] Weird characters while pasting in terminal

Hello,

I get the same results if i'm using ctrl+shift +c to copy  or if i'll just select the text and then shift+insert.

If you need more info here are:

# echo $TERM
xterm-256color

# env
LC_PAPER=en_US.UTF-8
LESS_TERMCAP_mb=
LC_ADDRESS=en_US.UTF-8
XDG_SESSION_ID=2
LC_MONETARY=en_US.UTF-8
LESS_TERMCAP_md=
LESS_TERMCAP_me=
TERM=xterm-256color
SHELL=/bin/bash
HISTSIZE=100000
LC_NUMERIC=en_US.UTF-8
LESS_TERMCAP_ue=
SSH_TTY=/dev/pts/0
USER=root
LC_TELEPHONE=en_US.UTF-8
SSH_AUTH_SOCK=/tmp/ssh-WJrjEKpuaR/agent.681
LESS_TERMCAP_us=
MAIL=/var/spool/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl
LC_MESSAGES=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
PWD=/root
JAVA_HOME=/usr/lib/jvm/java-7-openjdk/jre
LANG=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
HISTCONTROL=ignoreboth
SSH_ASKPASS=/usr/lib/ssh/x11-ssh-askpass
SHLVL=1
HOME=/root
LESS=-R
LOGNAME=root
LESS_TERMCAP_so=
LC_CTYPE=en_US.UTF-8
XDG_RUNTIME_DIR=/run/user/0
LC_TIME=en_US.UTF-8
HISTTIMEFORMAT=%h %d %H:%M:%S 
LESS_TERMCAP_se=
LC_NAME=en_US.UTF-8
_=/usr/bin/env

Offline

#7 2013-12-21 22:46:33

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: [SOLVED] Weird characters while pasting in terminal

it seems op is using some bloatware terminal instead of urxvt ;-) and/or is confusing primary and secondary clipboard copy/paste commands.

Last edited by ondoho (2013-12-21 22:47:09)

Offline

#8 2013-12-21 22:57:05

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Weird characters while pasting in terminal

Are you using ssh?
Does this happen if you're copy-pasting as a normal user?

Offline

#9 2013-12-21 23:17:34

never2far
Member
Registered: 2013-12-21
Posts: 5

Re: [SOLVED] Weird characters while pasting in terminal

karol wrote:

Are you using ssh?
Does this happen if you're copy-pasting as a normal user?

Yes I was using SSH to connect to the server and the problem occurred only from a specific instance of a terminal (I wasn't aware of it until few minutes ago).
After some tests I have closed that problematic terminal (gnome-terminal installed on a Ubuntu machine) and tried another one...the situation never appeared so thank you all for helping me.

Last edited by never2far (2013-12-21 23:20:05)

Offline

#10 2013-12-21 23:41:22

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Weird characters while pasting in terminal

In future, please include that sort of detail in your first post; it prevents a lot of wasted time and energy.

See How To Ask Questions The Smart Way.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#11 2014-05-19 09:06:18

slava888
Member
Registered: 2013-01-09
Posts: 6

Re: [SOLVED] Weird characters while pasting in terminal

For all having the issue as well and finding this topic through google:
something has enabled 'bracketed paste mode' on your terminal. gnome-terminal (and based on it terminator) does not handle it currently well, see for example:
http://www.midnight-commander.org/ticket/3207
To disable the bracketed paste mode:
printf "\e[?2004l"
(from http://cirw.in/blog/bracketed-paste)
Cures the terminal (gnome-terminal, terminator) immediately for me.

Offline

#12 2016-05-31 01:09:27

agg3l
Member
Registered: 2016-05-31
Posts: 4

Re: [SOLVED] Weird characters while pasting in terminal

Experiencing the very same issue occasionally, for last couple of weeks, I guess
Following resolves it:

slava888 wrote:

To disable the bracketed paste mode:
printf "\e[?2004l"

Yet I wonder what is the reason/source for the problem.
I'm using latest Xfce & Xfce terminal from Arch maintainers (i.e. not AUR builds)...
May be someone have have any ideas what has had changed...

The most annoying app I use on a regular basis is Chromium; cannot it be the troublemaker?

Offline

#13 2016-05-31 01:18:32

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Weird characters while pasting in terminal

Please don't necrobump, especially solved threads: https://wiki.archlinux.org/index.php/Fo … bumping.22



Closing


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB