From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: url-retrieve and encoding
Date: Sun, 11 Feb 2024 21:21:39 +0200 [thread overview]
Message-ID: <86eddist6k.fsf@gnu.org> (raw)
In-Reply-To: <ZckIpaUKuR5OzDQf@tuxteam.de> (tomas@tuxteam.de)
> Date: Sun, 11 Feb 2024 18:49:25 +0100
> From: tomas@tuxteam.de
> Cc: help-gnu-emacs@gnu.org
>
> > > Yes: decode-coding-region.
> >
> > Ahhh -- thanks a bunch for this one! How could I have missed it.
> >
> > > > (...) But that feels
> > > > a bit... gross:
> > >
> > > Indeed. Why didn't you try decoding to begin with?
>
> OK, now I can answer this question more precisely: actually, I'd
> been there already and was coufused that the function did... nothing.
>
> Now at least I know why: the buffer is unibyte.
The solution is (quite obviously) not to do that in-place.
Alternatively, you could make the buffer multibyte in advance, but
that's tricky, so I don't recommend that.
> Its content /is/ utf-8.
That's not really 100% accurate, although it's close. If the unibyte
buffer includes byte sequences that are not valid UTF-8, decoding does
change the byte stream in those places.
> But then... I can do things "in buffer" by simply invoking
> (toggle-enable-multibyte-characters t). At least, it seems to
> work. But... is it a good idea?
No. Always call the decode function, never play with
multi-uni-byteness, because the latter will eventually surprise (or
bite) you.
next prev parent reply other threads:[~2024-02-11 19:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-10 19:31 url-retrieve and encoding tomas
2024-02-10 19:41 ` Eli Zaretskii
2024-02-10 19:49 ` tomas
2024-02-11 17:49 ` tomas
2024-02-11 19:21 ` Eli Zaretskii [this message]
2024-02-12 5:30 ` tomas
2024-02-10 20:51 ` Tim Landscheidt
2024-02-11 6:30 ` tomas
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=86eddist6k.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/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.