From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 75415@debbugs.gnu.org
Cc: monnier@iro.umontreal.ca
Subject: bug#75415: 31.0.50; quoted-printable-en/decode-region doesn't preserve end markers
Date: Mon, 06 Jan 2025 23:24:15 -0500 [thread overview]
Message-ID: <jwvttabmf9f.fsf-monnier+@gnu.org> (raw)
Package: Emacs
Version: 31.0.50
In a fresh Emacs try:
(with-temp-buffer
(set-buffer-multibyte nil)
(insert "\300\300")
(encode-coding-region (point-min) (point) 'utf-8)
(quoted-printable-encode-region (point-min) (point))
(insert "!!")
(buffer-string))
It will likely return "=C0!!=C0" whereas it should return "=C0=C0!!".
Found via a bug in VM: https://gitlab.com/emacs-vm/vm/-/issues/491
The same problem plagues `quoted-printable-decode-region`.
I think we really need to introduce a `replace-region` primitive which
takes care of preserving the position of markers instead of having to teach
ELisp coders the delicate art of combining `insert(-before-markers)` and
`delete` to best preserve markers.
Stefan
next reply other threads:[~2025-01-07 4:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 4:24 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2025-01-07 19:45 ` bug#75415: 31.0.50; quoted-printable-en/decode-region doesn't preserve end markers Stefan Kangas
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvttabmf9f.fsf-monnier+@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=75415@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).