From: Stephen Berman <stephen.berman@gmx.net>
To: Zhang Haijun <ccsmile2008@outlook.com>
Cc: Phil Sainty <psainty@orcon.net.nz>, Eli Zaretskii <eliz@gnu.org>,
"emacs-devel@gnu.org" <emacs-devel@gnu.org>
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 [thread overview]
Message-ID: <87wopr36vl.fsf@rub.de> (raw)
In-Reply-To: <SG2PR0601MB1405DFF34B9E61451FF008C2A8CA0@SG2PR0601MB1405.apcprd06.prod.outlook.com> (Zhang Haijun's message of "Mon, 5 Nov 2018 14:08:46 +0000")
On Mon, 5 Nov 2018 14:08:46 +0000 Zhang Haijun <ccsmile2008@outlook.com> 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
next prev parent reply other threads:[~2018-11-05 15:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-04 8:44 26.1.50; Emacs can't decode the text file on opening the file, but can decode it on revert-buffer Zhang Haijun
2018-11-04 9:18 ` Eli Zaretskii
[not found] ` <16B3CA28-C893-4854-AD64-1C224C1EDDB2@outlook.com>
2018-11-04 14:49 ` Eli Zaretskii
[not found] ` <B213388B-58E6-4F5B-8CE8-79AC5AD3062B@outlook.com>
2018-11-04 17:13 ` Eli Zaretskii
2018-11-05 8:59 ` Zhang Haijun
2018-11-05 9:00 ` Zhang Haijun
2018-11-05 9:00 ` Zhang Haijun
2018-11-05 9:39 ` Phil Sainty
2018-11-05 10:10 ` Stephen Berman
2018-11-05 14:08 ` Zhang Haijun
2018-11-05 15:02 ` Stephen Berman [this message]
2018-11-05 16:00 ` Eli Zaretskii
2018-11-06 1:39 ` Zhang Haijun
2018-11-06 3:31 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wopr36vl.fsf@rub.de \
--to=stephen.berman@gmx.net \
--cc=ccsmile2008@outlook.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=psainty@orcon.net.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.