A parse error message shows a token of more than 8192 bytes by its
first and its last 4096 bytes around "...". The cuts were at fixed byte
offsets, so they could split a UTF-8 character: for valid UTF-8 input,
what() and the last token passed to SAX parse_error() were not valid
UTF-8, and storing the message in a json value and dumping it threw
type_error.316.
Move the end of the first part back and the start of the last part
forward to a character boundary, by at most three bytes each. The
lexer always reads bytes (wide strings are converted to UTF-8 first),
and the decision depends only on bytes inside the two parts, so the
message stays the same for every kind of input. Both parts only get
shorter, so the buffers that keep the token need no more room.
Signed-off-by: Niels Lohmann <mail@nlohmann.me>