mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-11 01:24:36 +00:00
wstring convert for mpt
This commit is contained in:
parent
6d718525c4
commit
0485fa65a2
5 changed files with 30 additions and 7 deletions
|
@ -122,8 +122,14 @@ std::string convert_to_utf8(const std::wstring & input) {
|
|||
|
||||
|
||||
std::wstring convert_to_wstring(const std::string & input) {
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
||||
return converter.from_bytes(input);
|
||||
try {
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
||||
return converter.from_bytes(input);
|
||||
} catch (const std::range_error& e) {
|
||||
return L"";
|
||||
} catch (...) {
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
|
||||
void gpt_split_words(std::string str, std::vector<std::string>& words) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue