I am having encoding issues with EMACS (ESS). Part of the problem is that many of my file paths contain a special character (ý). These characters keep getting converted to "ý" when I close and reopen the buffer.
C-h v buffer-file-coding-system RET
used to give:
Its value is ‘iso-latin-1-unix’
Local in buffer file.r; global value is iso-latin-1-dos
I added (setq-default buffer-file-coding-system 'utf-8-unix)
to my init.el file, and now
C-h v buffer-file-coding-system RET
gives:
Its value is ‘iso-latin-1-unix’
Local in buffer file.r; global value is utf-8-unix
If I correct the letters and use C-x RET r utf-8-unix RET
they get re-written as \375
.
I added the following lines to my init.el
(setq-default buffer-file-coding-system 'utf-8-unix)
(setq-default coding-system-for-read 'utf-8-unix)
(prefer-coding-system 'utf-8-unix)
And now
C-h v buffer-file-coding-system RET
gives:
Its value is ‘utf-8-unix’
Local in buffer file.r; global value is the same.
but R in EMACS ESS no longer works. Shift-enter to start the minor process and execute a line of R code causes EMACS to freeze and all I get is a spinning wheel until I force quit.
So I removed those lines from my init.el to restore R.
When I start R there is a error message "Error: invalid multibyte character in parser at line 1" which has to do with setwd()
as the file path has the character ý in it.
If I put file.r
into a directory that does not have ý
in the path, everything works correctly.