The do_unescape function pushes the unicode codepoints in BE order into the utf-8 stream. This is not correct.