When I want to send an email I composed in Emacs, I press C-c C-c and am always presented with such an error message:

These default coding systems were tried to encode text
in the buffer `2015-02-03_19:08:30_1':
  (utf-8-unix (302 . 4194243) (303 . 4194208) (305 . 4194243) (306 .
  4194217) (308 . 4194243) (309 . 4194221) (311 . 4194243) (312 .
However, each of them encountered characters it couldn't encode:
  utf-8-unix cannot encode these:        

Click on a character (or switch to this window by `M-o'
and select the characters by RET) to jump to the place it appears,
where `C-u M-x what-cursor-position' will give information about it.

At this point I can manually select an encoding and my email is sent. What I don't understand is that I always select utf-8 as the encoding when I receive this message and it just works! But the message said that utf-8-unix can't encode some characters.

Can somebody tell me why Emacs can't select utf-8 by default and what this error message mean in this context?

EDIT 2015/02/05

I'm using mu4e and I tried (setq-default buffer-file-coding-system 'utf-8) without success (after evaluating this expression, if I start writing a new email, the variable's value is not 'utf-8 but 'utf-8-unix).

EDIT 2015/02/06

I also tried M-x set-keyboard-coding-system utf-8 and (setq mm-coding-system-priorities '(utf-8)) but this had no visible effect.

EDIT 2015/02/21

I've just noticed this problem only happens if smtpmail-queue-mail is t. So I guess the problem is in the email queueing feature.

  • Does the incantation to prefer utf-8 in all buffers help? (setq-default buffer-file-coding-system 'utf-8)
    – PythonNut
    Feb 3, 2015 at 23:34
  • Which mailer are you using? RMAIL, Gnus, Wanderlust?
    – jch
    Feb 3, 2015 at 23:56
  • @jch It's tagged mu4e.
    – PythonNut
    Feb 4, 2015 at 1:20
  • I answered by editing the question Feb 5, 2015 at 9:47
  • can the setting (set-keyboard-coding-system 'utf-8) help?
    – Name
    Feb 5, 2015 at 15:34

3 Answers 3


I have dealt with this issue a lot. The encoding will be depending on information in the file. If there is no information in the file explicitly to determine what it is, you could get such things as above.

If your work doesn't involve a lot of ancient systems which require different coding, you could consider to force default UTF-8 coding everywhere. It’s practically a standard nowadays, at least in the West (for me anyway), as it is dominant on the Web; has a one-to-one mapping with ASCII; flexible enough to represent any unicode character in the world. But in order to make Emacs use UTF-8 everywhere by default:

(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-language-environment 'utf-8)

Once evaluated, Emacs will treat new files, buffers, processes, and so on as though they are UTF-8. Keep in mind Emacs will still use a different coding system if the file has a file-local variable like this -*- coding: euc-tw -*- near the top of the file. (Check 48.2.4 Local Variables in Files in the Emacs manual.)

  • I have added these lines to .emacs. However, if I create a new TeX file, "file -bi" still reports that it is encoded as us-ascii. Any ideas? Feb 7, 2016 at 17:16

I use Emacs built-in compose-mail (C-x m) to send email and encountered similar issue on encoding. I don't sure if this would help you:

(setq mm-coding-system-priorities '(utf-8))
  • no effect (I've edited the question) Feb 6, 2015 at 20:41

With all the settings above the encoding windows continued to show up. I did more investigation and I found out that setting:

(setq message-default-charset 'utf-8)
(add-to-list 'mm-body-charset-encoding-alist '(utf-8 . base64))

Solved the issue for me. I'm working on Mac OS 10.14.5, Emacs 26.1.

  • Why this answer is downvoted? As I said it solved the problem for me, and I just wanted to share.
    – Navidot
    Jan 15, 2021 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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