Improved handling of malformed surrogate pairs.