After a lot of headbanging, this patch seems to work. It does one sort of manual replacing, but I've tested with all sorts of evil test data and it seems to survive those, and it still parses valid utf-8 multibyte correctly.
armedbear-devel@common-lisp.net