Fixed encoding of unicode surrogates