From: Eli Zaretskii <eliz@gnu.org>
To: Thien-Thi Nguyen <ttn@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: string-to-unibyte in image-jpeg-p
Date: Wed, 23 May 2018 23:01:08 +0300 [thread overview]
Message-ID: <831se2cfaz.fsf@gnu.org> (raw)
In-Reply-To: <87zi0q3c5b.fsf@gnuvola.org> (message from Thien-Thi Nguyen on Wed, 23 May 2018 12:21:52 +0200)
> From: Thien-Thi Nguyen <ttn@gnu.org>
> Date: Wed, 23 May 2018 12:21:52 +0200
>
> (setq data (let ((tem (encode-coding-string data 'binary)))
> (unless (string-match-p "\xc2" tem)
> tem)))
>
> My questions are:
> - Is my reasoning correct? In particular, i'd like to confirm
> that the "error" detection via "\xc2" is a valid strategy.
I'm not sure. #xC2 is the leading byte of a 5-byte representation of
raw bytes, right? There are also 2-byte representations, which begin
with C0 and C1 respectively.
> - If so, which branch gets the change, ‘emacs-26’ or ‘master’?
master in any case, but see below.
> - If not, what am i missing?
Doesn't it feel strange to encode a string using 'binary', which is an
alias for 'no-conversion' as the encoding? Is it intuitive to do
something like that? Is the meaning obvious (I guess not)?
So I'd rather we left string-to-unibyte alone in this case, instead of
artificially replacing it with encode-coding-string. And maybe we
should un-deprecate string-to-unibyte, since this is the _only_ place
where it's called, and if used correctly, that function has no good
replacements.
Thanks.
next prev parent reply other threads:[~2018-05-23 20:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 10:21 string-to-unibyte in image-jpeg-p Thien-Thi Nguyen
2018-05-23 19:43 ` Stefan Monnier
2018-05-23 20:01 ` Eli Zaretskii [this message]
2018-05-23 20:17 ` Andreas Schwab
2018-05-23 20:29 ` Stefan Monnier
2018-05-23 20:46 ` Paul Eggert
2018-05-24 8:51 ` Robert Pluim
2018-05-24 15:19 ` Eli Zaretskii
2018-05-24 15:31 ` Robert Pluim
2018-05-24 17:09 ` Eli Zaretskii
2018-05-24 19:51 ` Stefan Monnier
2018-05-25 6:10 ` Eli Zaretskii
2018-05-25 18:01 ` Stefan Monnier
2018-05-25 19:13 ` Eli Zaretskii
2018-05-25 20:39 ` Stefan Monnier
2018-05-26 8:27 ` Eli Zaretskii
2018-05-31 10:40 ` Robert Pluim
2018-05-31 14:50 ` Eli Zaretskii
2018-05-31 15:17 ` Robert Pluim
2018-05-24 15:59 ` Stefan Monnier
2018-05-24 17:00 ` Eli Zaretskii
2018-05-24 19:51 ` Stefan Monnier
2018-05-25 6:10 ` Eli Zaretskii
2018-05-26 21:02 ` Stefan Monnier
2018-05-24 16:57 ` 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
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=831se2cfaz.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=ttn@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 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).