Subject: Re: bug#42904: [PATCH] Non-Unicode frame title crashes Emacs on macOS

From: Eli Zaretskii <[email-masked]>
Date: Mon, 17 Aug 2020 18:55:36 +0300

> From: Mattias Engdegård <[email-masked]>
> Date: Mon, 17 Aug 2020 16:11:52 +0200
> Cc: Alan Third <[email-masked]>
> 
> Proposed patch attached. I didn't find any obvious way to encode an
> Emacs string into valid UTF-8 (with bad parts replaced) so a new
> function was written.

Is something wrong with encode_string_utf_8?  It has arguments that
allow you to replace invalid bytes into the likes of u+FFFD.  Or did I
misunderstand the problem you are facing?