I ran into an issue pasting text from a Reddit Comment that I had originally written on my iPhone in the Reddit iOS app to Emacs running in terminal on NetBSD on the SDF.org cluster. Instead of the text pasting in, it gave an error: “Wrong type argument: char-or-string-p, 134217826”.
It turned out that my iPhone had put fancy apostrophes in the Reddit comment. I didn’t have the same problem with GUI Emacs on MacOS on my personal computer. At least the problem didn’t take the same form. The text would paste in, and flag the fancy apostrophes as not conforming to the default ASCII encoding. GUI Emacs then allowed me to replace the fancy apostrophes with basic ASCII ones and save the file with the default encoding. Unfortunately I needed a solution that worked on terminal Emacs while connecting to NetBSD with an SSH terminal app running on my iPhone. Terminal Emacs required the encoding of the pasted text to match the default encoding to allow any editing at all.
A fair bit of Google searching turned up an a detailed solution on julialang.org.
; Solution provided by Ivo Welch on discourse.juilialong.org Feb 2018
; "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)
Thanks to Ivo Welch’s simple solution. My terminal Emacs on NetBSD default’s to UTF-8 encoding and I can paste text composed with an iOS app freely. Fortunately I’m generally typing Gemtext, so Unicode text will work fine for my purposed.
Updated 2026-06-02