I having problem with utf-8 strings because function buildstring() fill the “1” in the high bits of char_t type of for chars values more 0x7F. It problem have a 8/16 bit firmwire.
I fixed this problem like (bold font the changes):
void buildstring (chars_t ch, object **tail) {
ch &= 0xFF;
object *cell;
if (cdr(*tail) == NULL) {
cell = myalloc(); cdr(*tail) = cell;
} else if (((*tail)->chars & 0xFF) == 0) {
(*tail)->chars |= ch; return;
} else {
cell = myalloc(); car(*tail) = cell;
}
car(cell) = NULL; cell->chars = ch<<8; *tail = cell;
}