I'm learning emacs (on spacemacs) and focusing on orgmode.

When I paste into an org-mode buffer from a non-english language that contains accents and other signs (in my case italian and spanish) I get:

These default coding systems were tried to encode text In the buffer... : utf-8-unix (2291 . 4194183) (2330 . 4194194) (2334 . 4194194) (2353 . 4194194) (2367 . 4194194) (2397 . 4194199) (2400 . 4194240) (2403 . 4194183) (2449 . 4194204) (2463 . 4194199) (2519 . 4194198)) However, each of them encountered characters it couldn't‚be encode: utf-8-unix cannot encode these: á í í í í ó ¿ á ú ó ...

Is there a way to convert the characters when pasting?

Thanks in advance.


The following solved it (I pasted it in the init part of my spacemacs configuration):

(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(setq buffer-file-coding-system 'utf-8)
(setq erc-server-coding-system '(utf-8 . utf-8))
(setq locale-coding-system 'utf-8)
;; Treat clipboard input as UTF-8 string first; compound text next, etc.
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))

(setenv "LANG" "fr_FR.UTF-8")
(setenv "LC_ALL" "fr_FR.UTF-8") 
  • FYI: You can accept your own answer.
    – Drew
    Aug 12 '20 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.