Skip to content
Snippets Groups Projects
Commit b732b019 authored by Krzysztof Gałązka's avatar Krzysztof Gałązka
Browse files

Fix in SCC menu string decoding

* Do decoding without checking locales which could be unset
or set to wrong encoding. Just try UTF-8 first and if that fails use ISO.
parent eab2ee5d
No related branches found
No related tags found
No related merge requests found
......@@ -210,14 +210,13 @@ SCCMenu* SCCApp::CreateMainMenu() {
#ifdef MINGW32
smenu = SCCMenu::ParseMenu(wxString(SC::A2S(buffer)));
#else
setlocale(LC_CTYPE, "");
char* enc = nl_langinfo(CODESET);
if (0 != strncmp(enc, "UTF-8", strlen(enc))) {
smenu = SCCMenu::ParseMenu(wxString(SC::A2S(buffer)));
} else {
try {
smenu = SCCMenu::ParseMenu(wxString(SC::U2S((unsigned char *)buffer)));
}
catch (const std::runtime_error& ex) {
wxLogWarning(_T("Decoding szarp.cfg from UTF-8 failed, trying ISO-8859-2"));
smenu = SCCMenu::ParseMenu(wxString(SC::A2S(buffer)));
}
#endif /* MINGW32 */
free(buffer);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment