Certainly.  But I hardly see any use for anything but U+FFFD, whose whole purpose is precisely to represent an unknown, unrecognized or unrepresentable character.  We could raise-continuably, and then if the exception *is* continued, plug in a U+FFFD.

Definitely just ignoring the character is a Very Bad Thing.



"Well, I'm back."  --Sam        John Cowan <xxxxxx@ccil.org>


On Fri, Feb 7, 2020 at 10:42 AM Lassi Kortela <xxxxxx@lassi.io> wrote:
> I think therefore that the Right Thing to do with an unpaired surrogate,
> since it is not possible to represent it as as a Scheme character, is to
> raise an exception.   Alternatively, there could be an argument whose
> value is either the symbol `raise` or the symbol `replace`.  In the
> latter case, an unpaired surrogate could be converted to #\uFFFD.

Can we raise a continuable exception that gets the invalid string or
bytevector, and can return the string (or other object) to use instead?