Fix parser with regards to invalid Unicode characters and offsets

If a stream contains half of a surrogate pair, don't eat the character following it.
More for #427 (EOF and invalid surrogate pairs)