emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string-to-unibyte in image-jpeg-p


From: Eli Zaretskii
Subject: Re: string-to-unibyte in image-jpeg-p
Date: Wed, 23 May 2018 23:01:08 +0300

> From: Thien-Thi Nguyen <address@hidden>
> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]