I have a lot of filenames in Russian in my file system. Every time I close Emacs if I had eshell opened, it shows a *temp* buffer with a list of directories. And asks 2 questions:

  1. Select coding system (default utf-8):

    I click enter

  2. Selected encoding utf-8 disagrees with latin-2 specified by file contents. Really save (else edit coding cookies and try again)? (y or n)

    I click "y", enter

What file cookies is he talking about? Where can I set it to utf-8, so this question is never asked again?


I found the wrong file: ~/.emacs.d/eshell/lastdir. I saved this: "яОяН­яОяННяОуВяНЕяОяОяННяОяНОяОяНВяОяНА" instead of normal Russian name. Then it tries to save it again.

  • I can't find any mention of such a file "cookie" in the manual, may it may refer to gnu.org/software/emacs/manual/html_node/emacs/… – JeanPierre Apr 3 '17 at 19:06
  • @JeanPierre Maybe, it tries to save the history of eshell somewhere? – user4035 Apr 3 '17 at 19:09
  • Do you have all of the following set? (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) – mclear Apr 5 '17 at 3:23
  • @mclear Tried, didn't help. Please, see the update: I found the file that causes the error, but don't know, what to do with it. – user4035 Apr 5 '17 at 8:02

I was facing a similar problem i.e while closing the Emacs (my version 26.3), I was repeatedly prompted about the encoding: Select coding system (default utf-8):

I solved the problem by deleting some entries from .emacs.d/ac-comphist.dat file (in my case, the character is the lowercase lambda λ).

| improve this answer | |
  • Sounds like a bug in the package that writes ac-comphist.dat. Please report it accordingly. – Stefan Apr 19 at 1:50

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.