emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 26.1.50; Emacs can't decode the text file on opening the file, but c


From: Eli Zaretskii
Subject: Re: 26.1.50; Emacs can't decode the text file on opening the file, but can decode it on revert-buffer
Date: Sun, 04 Nov 2018 16:49:40 +0200

> From: Zhang Haijun <address@hidden>
> CC: "address@hidden" <address@hidden>
> Date: Sun, 4 Nov 2018 12:28:52 +0000
> 
> > This file includes null bytes, which by default cause Emacs to disable all 
> > decoding, because such files are deemed to be binary files.
> > If you don't like this, set inhibit-null-byte-detection to a non-nil value.
> > 
> > This is not a bug, but the intended behavior.
> 
> Then why the encoding of the buffer changed after revert-buffer?

It's a subtle bug: revert-buffer reads and decodes the file in small
chunks, so by the time it gets to the furst null byte, it already
decided that the encoding is UTF-8.  By contrast, find-file decodes
the entire file at once, so it sees the null bytes when it detects the
encoding.

We had this behavior since Emacs 23.1; Emacs 22 doesn't change the
encoding when this buffer is reverted.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]