This error is caused by an illegal byte sequence.
You need to handle multiple characters as a single character.
The symbolic name for this error is EILSEQ, errno=88.