Re: Gnus error checking in encode-coding-*
Andreas Schwab <[email protected]>
| Newsgroups | gmane.emacs.devel |
|---|---|
| Message-ID | <[email protected]> |
On Aug 28 2026, Nickolai Dobrynin wrote:
> Is there a standard unified way to do error checking in encode-coding-*?
> As an example, I get
>
>> (encode-coding-string "ä" 'us-ascii)
> "?"
>
> with no obvious way to ask `encode-coding-string' to raise an error. I
> suppose, I could just convert the result ("?" in this case) back into
> internal representation and check it against the original string, but is
> this really the right strategy? It would seem that something like this
> should be automated.
You can use find-coding-systems-{string,region} to get a list of all
suitable coding systems, and then check whether the desired one is
included. See select-safe-coding-system.
--
Andreas Schwab, [email protected]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."