Fix passing gb2312 encoded strings to tts on Windows (#1819)

This commit is contained in:
Fangjun Kuang
2025-02-08 09:48:58 +08:00
committed by GitHub
parent 51b42748e5
commit d38cb81014
3 changed files with 155 additions and 0 deletions

View File

@@ -127,6 +127,18 @@ void ToLowerCase(std::string *in_out);
std::string RemoveInvalidUtf8Sequences(const std::string &text,
bool show_debug_msg = false);
// Return true if text contains valid utf8 sequence.
// Return false otherwise
bool IsUtf8(const std::string &text);
// Return true if text contains valid gb2312 encoded sequence
// Return false otherwise
bool IsGB2312(const std::string &text);
#if defined(_WIN32)
std::string Gb2312ToUtf8(const std::string &text);
#endif
} // namespace sherpa_onnx
#endif // SHERPA_ONNX_CSRC_TEXT_UTILS_H_