Move tokenizer_state_init after output_init, because if the first character is invalid UTF-8, this may cause an error that's written into uninitialized output->errors.