[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to find the character breaking the file encoding?
From: |
Óscar Fuentes |
Subject: |
Re: How to find the character breaking the file encoding? |
Date: |
Wed, 05 Feb 2020 03:42:29 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (gnu/linux) |
Marcin Borkowski <mbork@mbork.pl> writes:
> I have a large UTF-8 file (about 1.5MB) to which I add stuff regularly.
> Recently, Emacs started saving it as a binary file. I suspect I somehow
> inserted a non-UTF-8 sequence of bytes there. Is there any way Emacs
> can help me finding it (other than me manually bisecting the file until
> I find the offending place)?
Try using M-x encode-coding-region ENTERT utf-8 ENTER
With some luck this will mark the buffer as modified because it replaces
unencodable content with blanks (IIRC). Then you can use M-x
diff-buffer-with-file to see the line that contains the problematic
sequence.