[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Text copied from *grep* buffer has NUL (0x00) characters
From: |
Stefan Monnier |
Subject: |
Re: Text copied from *grep* buffer has NUL (0x00) characters |
Date: |
Sun, 09 May 2021 15:47:18 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>> For the detection of NULs in UTF-8 files, you could also ask for such
>> a feature via `M-x report-emacs-bug` but it should be pretty easy to get
>> something comparable with something like:
>> [...]
>
> I don't think it is desirable for users to install such Lisp hooks to deal
> with such corner cases.
There's a tension between avoiding pitfalls and making it inconvenient
for corner cases.
I do think there's a real plain bug here, tho, if you change your
"recipe" to `uft-8` instead `utf-8-with-signature`: take a utf-8 text
file (in a UTF-8 locale), add a NUL byte to it, save, close, and
re-open: you now get a unibyte buffer showing the bytes rather than
the chars.
Emacs should generally try and warn you when saving a file with a coding
system different than the one it would guess when later re-opening the file.
The problem doesn't show up with `utf-8-with-signature` because
apparently the BOM is given more weight than the NUL byte in determining
which coding system to use.
> My opinion is that Emacs should be more helpful here by default.
No point arguing here then: make it a bug report.
`help-gnu-emacs` is rather for the case where you're looking for
a workaround (or when you suspect what you're seeing is a "feature" you
just fail to understand) rather than fixing it "for everyone".
Stefan
Re: Text copied from *grep* buffer has NUL (0x00) characters, Stefan Monnier, 2021/05/09