[Top][All Lists]

[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: Stephen Berman
Subject: Re: 26.1.50; Emacs can't decode the text file on opening the file, but can decode it on revert-buffer
Date: Mon, 05 Nov 2018 16:02:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On Mon, 5 Nov 2018 14:08:46 +0000 Zhang Haijun <address@hidden> wrote:

> On 11/05/2018 05:39 PM, Phil Sainty wrote:
>> On 5/11/18 10:00 PM, Zhang Haijun wrote:
>>> On 11/05/2018 01:13 AM, Eli Zaretskii wrote:
>>>> They are not invalid bytes, they are zero bytes.  You can search for
>>>> them like this:
>>>>     C-s C-q C-SPC
>>> I mean chars like ^@, ^H and \342\200\230. How to search them?
>> ^@ is the null char and Eli just showed you how to search for it.
>> Similarly, C-s C-q C-h will search for a ^H char.
>> Assuming \342\200\230 is three octal characters then, I would probably
>> resort to editing the search string and using `insert-char':
>> C-s M-e
>> C-x 8 RET #o342 RET
>> etc...
>> If you can *see* an instance of the character already, you might just
>> move point to that character and use C-s C-w (and maybe a bit of C-M-w
>> if that grabs too many chars).
>> Or if you mean "any non-ascii character" then the regexp [^[:ascii:]]
>> will match those.
>> -Phil
> I don't know the specific char to search. As the orignal problem I met, 
> I opened the text file. Emacs can't decode it and it didn't show any 
> warning message like position of the null byte. Then what should I do to 
> find the null byte(or other bytes which can prevent emacs from decoding)?
> How to search these unknown bytes?

All of the above (the ascii control characters ^@ and ^H and octal
characters like \342\200\230) are non-printing characters, so you can
find them with this regexp isearch: `C-M-s [^[:print:]]'.

Steve Berman

reply via email to

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