Subject: Re: bug#70356: 30.0.50; [wishlist] Expose UTF-8 parse error to Lisp
From: Michael Albinus <[email-masked]>
To: Andreas Schwab <[email-masked]>
Cc: Eli Zaretskii <[email-masked]>, [email-masked]
Date: Sat, 13 Apr 2024 10:29:26 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Andreas Schwab <[email-masked]> writes:

Hi Andreas,

>> What I'd like to get is a function, which takes a sequence of bytes as
>> arguments, and which indicates, whether this is a valid UTF-8 byte
>> sequence. This indication could be an error, or a respective return
>> value.
>
> That function could do the decoding and then check whether the result
> contains any eight-bit characters (which mark the non-decodable parts).

Hmm. Thinking about, the following code does already what I want:

(string-to-unibyte (apply #'string bytes))

Closing the bug.

Best regards, Michael.