I am struggling with Emacs coding system for years, sometimes it does what I expect it to do, sometimes not? I am mostly writing in French, often in English also and starting a bit in Spanish. I would like to open and save pretty much all my files in utf-8-unix, I am sharing files between three machines, all running Linux and Emacs 25.2

Here is what I have regarding coding system in my .emacs file:

'(file-coding-system-alist (quote (("\\.gpg\\'" utf-8-unix . utf-8-unix)
                                   ("\\.txt\\'" utf-8-unix . utf-8-unix))))

(setq file-name-coding-system 'utf-8-unix)
(setq default-keyboard-coding-system 'utf-8-unix)
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))
(setq default-sendmail-coding-system 'utf-8-unix)
(setq default-terminal-coding-system 'utf-8-unix)
(setq buffer-file-coding-system 'utf-8-unix)

But no matter what, when I open a ".gpg" file, it always opens non converted, I have to revert-buffer to utf-8-unix to get the proper accented latin letters; then I set the coding system to save the file to utf-8-unix but next time I open it, there is no conversion and I have to revert-buffer every time, pretty anoying!

What is strange about it is that, I used the original version of the file for years without conversion problems. A few days ago I reverted to an Emacs backup of that file and from then on, problems every time I open it??

Any insights?

  • 1
    utf-8 has been the default under GNU/Linux for several years (and even longer for macOS), so all your settings above should be unnecessary. So, I'd focus on the concrete problem you're having. Please describe it more precisely. E.g. what do you mean by "non converted"? Does it happen for all files or just this one? Could it be that the file contains a NUL byte? – Stefan Mar 20 at 15:02

Your Answer

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

Browse other questions tagged or ask your own question.