1

I edit my files in cp1251 encoding.

This works fine on local host but when I save files on remote host using tramp it resets encoding to utf-8 constantly.

Even if I do (set-buffer-file-coding-system) to cp1251, it sets the encoding for awhile, but after saving the file it immediately resets to utf-8. The saved file appears in cp1251 as desired, but the buffer encoding becomes utf-8 and subsequent saving appears in utf-8

For example, I do (set-buffer-file-coding-system 'cp1251)

save file

the file on disk is in cp1251 encoding, but the encoding flag in the left bottom becomes U for utf-8

save file again

it is in utf-8 encoding

It happens regardless of if the file contains only ASCII symbols or non-ASCII symbols. I use Win 10

The issue appeared in emacs 29.1, everything was ok in 28.1

workaround

(defun set-remote-encoding ()
  "set buffer encoding to cp1251"
    (set-buffer-file-coding-system 'cp1251))

(add-hook 'before-save-hook 'set-remote-encoding)
2
  • 1
    Maybe it's a bug in Emacs 29? If you don't get a helpful answer here, maybe try M-x report-emacs-bug.
    – Drew
    Commented Aug 1, 2023 at 21:01
  • 1
    Yes, please write a bug report. There is bug#64164 (debbugs.gnu.org/64164), which looks similar. Needs to be investigated. Commented Aug 2, 2023 at 8:04

1 Answer 1

1

Finally, it turns out to be a bug in Tramp, see bug#65022. It has been fixed, will be available with Emacs 29.2. The GNU ELPA package Tramp 2.1.6.2 will contain this fix as well.

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.