Java doesn't use standard UTF8, so surrogate pairs were being converted incorrectly and incompatibly with C++. Fixes #69 (artf3973).