# Terminal emacs woes: paste julia output gives char-or-string-p error, \\u2502 displays, etc

**URL:** https://discourse.julialang.org/t/terminal-emacs-woes-paste-julia-output-gives-char-or-string-p-error-u2502-displays-etc/8981
**Category:** General Usage
**Created:** [February 10, 2018, 8:19pm UTC](https://discourse.julialang.org/t/terminal-emacs-woes-paste-julia-output-gives-char-or-string-p-error-u2502-displays-etc/8981 "2018-02-10T20:19:06Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ivo\_welch](https://avatars.discourse-cdn.com/v4/letter/i/d2c977/32.png) [@ivo\_welch](https://discourse.julialang.org/u/ivo_welch)
#### Post date: [February 10, 2018, 8:19pm UTC](https://discourse.julialang.org/t/terminal-emacs-woes-paste-julia-output-gives-char-or-string-p-error-u2502-displays-etc/8981/1 "2018-02-10T20:19:06Z")

</div>

this is _not_ a julia problem, but an emacs (utf8) problem using julia, but I was hoping someone had an answer for this. I use macos, iterm2 and terminal.

Copy the output of `d= DataFrame( x=1:3 )`

```julia
10×1 DataFrames.DataFrame
│ Row │ x │
├─────┼────┤
│ 1 │ 1 │
│ 2 │ 2 │
│ 3 │ 3 │

```

Now paste it into a terminal shall via `cat > /dev/null` and it works fine (suggesting that the terminal emulator and the bash configuration are all ok). Paste it into a Quartz emacs.app and it works fine, too (suggesting emacs is just fine, too).

**but** try pasting it into a terminal emacs, and hell breaks loose `Wrong type argument: char-or-string-p, 134217795`. Unlike quartz emacs, the terminal emacs also displays UTF-8 characters badly, for example, with \u2502 instead of the vertical line. Pretty sure this is related.

there are apparently many moving parts here–utf8, terminal emulation, bash, and emacs. I have tried a whole host of related configurations, but have not stumbled onto the right ones.

what config does it take to convince terminal emacs to be julia-utf8 friendly? help, as always, appreciated.

/iaw

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [February 11, 2018, 7:33am UTC](https://discourse.julialang.org/t/terminal-emacs-woes-paste-julia-output-gives-char-or-string-p-error-u2502-displays-etc/8981/2 "2018-02-11T07:33:15Z")

</div>

Can’t reproduce on Emacs 25.2.2, I just get syntax errors.

Also, why would I want to do this? What do you expect the REPL to do with something that is not valid Julia code?

---

<div class="post-metadata">

### Author: ![ivo\_welch](https://avatars.discourse-cdn.com/v4/letter/i/d2c977/32.png) [@ivo\_welch](https://discourse.julialang.org/u/ivo_welch)
#### Post date: [February 11, 2018, 7:33pm UTC](https://discourse.julialang.org/t/terminal-emacs-woes-paste-julia-output-gives-char-or-string-p-error-u2502-displays-etc/8981/3 "2018-02-11T19:33:19Z")

</div>

hi tamas—I am sorry for the confusion. I don’t mean pasting this into a julia REPL window. Just paste it into a text window. I am just trying to write explanations that are interspersed with Julia output.

/iaw

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [February 12, 2018, 7:11am UTC](https://discourse.julialang.org/t/terminal-emacs-woes-paste-julia-output-gives-char-or-string-p-error-u2502-displays-etc/8981/4 "2018-02-12T07:11:35Z")

</div>

I am not sure this is a Julia issue then. Also, it seems that you have a solution with the GUI version of Emacs, why can’t you just use that?

---

<div class="post-metadata">

### Author: ![antoine-levitt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/antoine-levitt/32/4008_2.png) [@antoine-levitt](https://discourse.julialang.org/u/antoine-levitt)
#### Post date: [February 12, 2018, 8:35am UTC](https://discourse.julialang.org/t/terminal-emacs-woes-paste-julia-output-gives-char-or-string-p-error-u2502-displays-etc/8981/5 "2018-02-12T08:35:11Z")

</div>

FWIW, this works fine in linux with gnome terminal.

---

<div class="post-metadata">

### Author: ![ivo\_welch](https://avatars.discourse-cdn.com/v4/letter/i/d2c977/32.png) [@ivo\_welch](https://discourse.julialang.org/u/ivo_welch)
#### Post date: [February 12, 2018, 4:24pm UTC](https://discourse.julialang.org/t/terminal-emacs-woes-paste-julia-output-gives-char-or-string-p-error-u2502-displays-etc/8981/6 "2018-02-12T16:24:37Z")

</div>

> [@Tamas\_Papp](#):
>
> I am not sure this is a Julia issue then.

I am sure—this is _not_ a julia issue. I had just hoped that others had run into the same problem and solved it. (I often work on a remote terminal, rather than a GUI, which is why this is very inconvenient. thanks, antoine, too: it is a weird combination problem of iterm2 and term-emacs, then…grrr.)

---

<div class="post-metadata">

### Author: ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)
#### Post date: [April 12, 2018, 5:10am UTC](https://discourse.julialang.org/t/terminal-emacs-woes-paste-julia-output-gives-char-or-string-p-error-u2502-displays-etc/8981/7 "2018-04-12T05:10:26Z")

</div>

The answer are the following entries in the .emacs.d/init.el

(setq locale-coding-system 'utf-8)  
(set-terminal-coding-system 'utf-8)  
(set-keyboard-coding-system 'utf-8)  
(set-selection-coding-system 'utf-8)  
(prefer-coding-system 'utf-8)

(define-coding-system-alias 'UTF-8 'utf-8)
