I'm on Windows 11, and emacs-version reports: GNU Emacs 29.1 (build 2, x86_64-w64-mingw32).

When I try to quit emacs, it interrupts and prompts me with these encoding errors. I'll paste an example *Warning* buffer below. Usually I select utf-8 in the minibuffer prompt, and it "works". But I have to do it a few times in a row, so it's annoying.

I don't know what the ' *temp file*' is. But it shows it to me, and I'll paste a bit of it below. As you can see there is a path with a ñ in it.

I tried calling (prefer-coding-system 'utf-8) in my init files, and it seems to work, but I'm a little worried.

So, what is this temp file, and is it the correct solution to add (prefer-coding-system 'utf-8) to my init file?

The *Warning* buffer:

These default coding systems were tried to encode the following
problematic characters in the buffer ‘ *temp file*’:
  Coding System           Pos  Codepoint  Char
  iso-latin-1-dos         644  #x303      ̃

However, each of them encountered characters it couldn’t encode:
  iso-latin-1-dos cannot encode these: ̃

Click on a character (or switch to this window by ‘C-t o’
and select the characters by RET) to jump to the place it appears,
where ‘C-u C-t =’ will give information about it.

Select one of the safe coding systems listed below,
or cancel the writing with C-g and edit the buffer
   to remove or modify the problematic characters,
or specify any other coding system (and risk losing
   the problematic characters).

  utf-8 euc-jis-2004 windows-1258 iso-2022-jp-2004 gb18030 utf-7
  utf-16 utf-16be-with-signature utf-16le-with-signature utf-16be
  utf-16le iso-2022-7bit utf-8-auto utf-8-with-signature
  vietnamese-tcvn vietnamese-vscii japanese-shift-jis-2004 utf-7-imap
  utf-8-emacs prefer-utf-8

The *temp file*:

  ((elisp org-element--headline-cache)
   (elisp org-element--cache))
  :persist-file "e9/ada0f8-3e1a-455d-914c-abd83e9a99af" :associated
  (:hash "7edde2cddf0661e32386d360eaf22831" :file "c:/Users/rober/Proton Drive/.../Español/SpanishWriting.org" :inode 985164656838)
  :expiry 30 :last-access 1707591293.048348 :last-access-hr "2024-02-10T12:54:53-0600")
  ((elisp org-element--headline-cache)
   (elisp org-element--cache))
  • That's a warning, not an error. You can do what that msg tells you, to find occurrences of the char it reported as not being able to be encoded in the coding system you're using. I don't see that tilde-like char in the text you posted, but maybe it's in the "...". You can also just pick one of the coding systems it mentions and use that, if you want to keep that particular char (instead of, say, replacing it with an ASCII/Unicode tilde char).
    – Drew
    Commented Feb 10 at 20:49
  • It's the ñ in "Español", right after the "...". This file (whatever it is) is not generated by me. I can't edit it. It's something internal to Emacs or some package. I should probably have mentioned that in my question. It doesn't seem right to have to select "utf-8" five times every time I quit Emacs.
    – Rob N
    Commented Feb 10 at 22:26
  • The help/query text doesn't show ñ as the problematic character (and I think that char may be OK for iso-latin-1-dos - but that "dos" worries me). It shows ~. Put your cursor on (just before) that character and use C-u C-x =, to see what the char really is. Put all such info in your question.
    – Drew
    Commented Feb 11 at 0:36
  • Find out where that text comes from. If you can't edit it and the current encoding can't encode it, then you can't save it anyway, so just ignore the warning.
    – Drew
    Commented Feb 11 at 0:38
  • It says the code point is #x303, so while it looks like ~ character from our common keyboards, it's not. U+303 is the combining tilde. That's one way to type an "ñ" -- ie, "n" + the combining char. Anyway, the buffer looks like it has org-mode stuff in it, so I'll ask them.
    – Rob N
    Commented Feb 11 at 1:02


Your Answer

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

Browse other questions tagged or ask your own question.