Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs: is there a way to determine coding system of a file?

Tags:

emacs

encoding

Suppose I open a file and find there

Ïåñíÿ àëüïèíèñòîâ

and so on. Can I make emacs find the correct encoding? AkelPad for example has such feature - in most cases it'll open a file with a correct encoding.

like image 639
Adobe Avatar asked Sep 17 '11 15:09

Adobe


1 Answers

This page http://www.gnu.org/s/libtool/manual/emacs/Recognize-Coding.html explains emacs' system for detecting coding systems. You can control it to some extent:

The variables auto-coding-alist, auto-coding-regexp-alist and auto-coding-functions are the strongest way to specify the coding system for certain patterns of file names, or for files containing certain patterns

You may have inadvertently disabled this feature:

However, there may be cases that you want to read escape sequences in a file as is. In such a case, you can set the variable inhibit-iso-escape-detection to non-nil. Then the code detection ignores any escape sequences, and never uses an ISO-2022 encoding. The result is that all escape sequences become visible in the buffer.

like image 156
Mike Sokolov Avatar answered Oct 04 '22 23:10

Mike Sokolov