Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using clipboard/ copy paste results in chinese looking characters (debian sid)

Using Emacs on my linux box (wheezy, awesome,gnome and kde) I run into big trouble using clipboard even from one emacs instance to another.

Everything I put into the clipboard is converted into chinese looking characters in emacs. Only solution is to copy paste into some other editor (e.g. nano, vi) save it and open it in emacs.

I use the same .emacs on my other (ubuntu) computer and on windows 7 with out any trouble. I erased all my previous encoding settings I had without any success.

http://stackoverflow.com/questions/ask

after copy paste gets

栊瑴㩰⼯瑳捡潫敶晲潬⹷潣⽭畱獥楴湯⽳獡k
like image 976
louis cypher Avatar asked Mar 31 '12 12:03

louis cypher


2 Answers

I run into the same problem today, with a little different environment tho. I've been using Emacs 24.3.1 on Windows 7, then switched to the same version running under Cygwin+XWin with the same .emacs.d config. While clipboard under Windows worked fine, with the config I had under Cygwin/XWin I had the same problem as in the question.

Under terminal it worked fine, with XWin the -Q worked too, so after a little digging, it turned out to be:

;; MS Windows clipboard is UTF-16LE
(set-clipboard-coding-system 'utf-16le-dos)

I don't remember why I added this. I must have copied it from some Emacs Wiki in early days. When I googled it now, it seems like a popular setting in people configs. It turns out, under Windows I don't need this line for clipboard to work properly with Emacs (quick check with some polish diacritical characters), and under Cygwin/XWin it finally started to work.

like image 91
Andrzej Lichnerowicz Avatar answered Nov 03 '22 00:11

Andrzej Lichnerowicz


(sorry, I haven't the reputation to comment, so I leave a clarification request here)

  • Are you using emacs in a terminal ? if so, which one (konsole, lxterm, xterm...) ?

  • Are you cut'n'pasting with mouse (middle click) or keyboard ?

  • Have you any clipboard manager running (eg glipper) ?

like image 33
ydache Avatar answered Nov 03 '22 00:11

ydache