diff --git a/src/spellchecker_hunspell.cpp b/src/spellchecker_hunspell.cpp index a294a51ac..ddb6c4339 100644 --- a/src/spellchecker_hunspell.cpp +++ b/src/spellchecker_hunspell.cpp @@ -196,7 +196,12 @@ void HunspellSpellChecker::OnLanguageChanged() { LOG_I("dictionary/file") << dic; - hunspell = agi::make_unique(agi::fs::ShortName(aff).c_str(), agi::fs::ShortName(dic).c_str()); +#ifdef _WIN32 + // The prefix makes hunspell assume the paths are UTF-8 and use _wfopen + hunspell = agi::make_unique(("\\\\?\\" + aff.string()).c_str(), ("\\\\?\\" + dic.string()).c_str()); +#else + hunspell = agi::make_unique(aff.string().c_str(), dic.string().c_str()); +#endif if (!hunspell) return; conv = agi::make_unique("utf-8", hunspell->get_dic_encoding());