I'm trying to make it possible to easily edit text in Cyrillic / Russian on a remote OpenBSD 5.2 amd64.

I'm using emacs-21.4p18-no_x11, which doesn't show any Cyrillic characters whatsoever when I try opening up a file with a windows-1251 encoding (instead showing question marks and sometimes even randomly mangling the file when a save is attempted), unless I start it as env LANG=bg_BG.CP1251 emacs (for some reason, there's no ru_RU.CP1251 in /usr/share/locale/) and PuTTY to Win1251 (Cyrillic); however, this only works in displaying the characters, not for typing any characters -- switching the local keyboard to Russian and typing into emacs causes various random internal commands to be executed, even though quitting emacs and using cat(1) works without any issues for Russian input (which could then be opened up in emacs and copy-pasted from the temp file to the real one, which is very cumbersome and unproductive).

I've also tried mg(1), but it shows up Russian characters as \315 etc, and doesn't let you type in Russian, either.

  • If the files I'm editing are nginx.conf, is there a way to automatically specify the encoding for emacs? All the File Variables examples appear to start with a mode, but there's no mode for nginx.conf.

  • How do I make emacs / mg load files in either windows-1251 or koi8-r, and show them in UTF-8?

  • How do I make emacs / mg accept Cyrillic input?

1 Answer 1


You can set the language environment to Russian.

M-x set-language-environment

If you than open your file it should be readable.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .