0

When I open a 100Mio file, Emacs asks me if I want to open in literal mode. I answer yes, but it's not loading the file as UTF-8.

Is there any way to set default UTF-8 for literal mode?

1
  • 2
    I am confused. When you open a large file, you're given 3 choices: "to open", "not to open" and "to open literally". The difference between "to open" and "to open literally" is exactly that it doesn't process any multibyte characters, etc. You can read more on this in C-h f find-file-literally. So, if you want unicode, just open the file as usual. If it is slow, you can disable various things for cases with large file.
    – Hi-Angel
    Feb 20 at 20:59

1 Answer 1

1

You cannot. That would be contrary to what Emacs means by "literal".

See C-hig (elisp)Disabling Multibyte

By default, Emacs starts in multibyte mode: it stores the contents of buffers and strings using an internal encoding that represents non-ASCII characters using multi-byte sequences. Multibyte mode allows you to use all the supported languages and scripts without limitations.

Under very special circumstances, you may want to disable multibyte character support, for a specific buffer. When multibyte characters are disabled in a buffer, we call that “unibyte mode”. In unibyte mode, each character in the buffer has a character code ranging from 0 through 255 (0377 octal); 0 through 127 (0177 octal) represent ASCII characters, and 128 (0200 octal) through 255 (0377 octal) represent non-ASCII characters.

To edit a particular file in unibyte representation, visit it using ‘find-file-literally’. *Note Visiting Functions::.

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.