diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index cc38eed211..c3b23eff5c 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -11,6 +11,23 @@ namespace sfs = std::filesystem; +namespace +{ + // from configfileparser.cpp + std::string trim_ws(const std::string& s) + { + std::string::size_type n, n2; + n = s.find_first_not_of(" \t\r\n"); + if (n == std::string::npos) + return std::string(); + else + { + n2 = s.find_last_not_of(" \t\r\n"); + return s.substr(n, n2 - n + 1); + } + } +} + MwIniImporter::MwIniImporter() : mVerbose(false) , mEncoding(ToUTF8::WINDOWS_1250) @@ -371,6 +388,8 @@ MwIniImporter::multistrmap MwIniImporter::loadCfgFile(const std::filesystem::pat std::string key(line.substr(0, pos)); std::string value(line.substr(pos + 1)); + key = trim_ws(key); + value = trim_ws(key); if (map.find(key) == map.end()) {