1

When I copy data from outside to my emacs, it is garbled

(venv)  tree ./scripts
scripts
├── foo.sh
├── bar.sh
├── start.sh
├── stop.py

However, when I paste this in emacs, I get this:

(venv)  tree ./scripts
scripts
\u251c\u2500\u2500 foo.sh
\u251c\u2500\u2500 bar.sh
\u251c\u2500\u2500 start.sh
\u251c\u2500\u2500 stop.py

I thought this was due to simpleclip. But I also get this in my magit when I issue git standup (using : standup from within emacs)

  0 git … standup
[31mbe041bb[m - fix sort by name; closes #636 [32m(21 hours ago) [1;34m<darshanime>[m
[31mfa80601[m - change vul order [32m(22 hours ago) [1;34m<darshanime>[m

which should be:

(venv)  git standup      
be041bb - fix sort by name; closes #636 (21 hours ago) <darshanime>
fa80601 - change vul order (21 hours ago) <darshanime>
  • 1
    The second example seems to be ansi sequences not decoded. Don't know how you issue git standup, I assume from shell, so you may try to (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on). – theldoria Jun 2 '17 at 8:43
  • 1
    The first example is something different, rather a problem with unicode. Probably the coding-system is wrong, what happens if you use (prefer-coding-system 'utf-8) or (prefer-coding-system 'utf-16) in your init.el? – theldoria Jun 2 '17 at 8:49
  • in the 1st example, I get the garbled content, even after (prefer-coding-system 'utf-16) and (prefer-coding-system 'utf-8). – Darshan Chaudhary Jun 2 '17 at 9:41
  • These might help. (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (set-language-environment 'utf-8) (set-selection-coding-system 'utf-8) (setq locale-coding-system 'utf-8) (prefer-coding-system 'utf-8) – fhdhsni Jun 2 '17 at 10:45
  • 2
    Possible duplicate of Pasting Text from Clipboard - why ^M instead of linebreaks? – rofrol Aug 2 '18 at 18:37

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.