Update all QSettings instances to use UTF-8

This commit is contained in:
in1tiate 2021-04-22 20:02:18 -05:00
parent 3e490252be
commit 87fe5c214d
2 changed files with 6 additions and 0 deletions

View File

@ -32,6 +32,7 @@ AreaData::AreaData(QString p_name, int p_index) :
name_split.removeFirst();
name = name_split.join(":");
QSettings areas_ini("config/areas.ini", QSettings::IniFormat);
areas_ini.setIniCodec("UTF-8");
areas_ini.beginGroup(p_name);
background = areas_ini.value("background", "gs4").toString();
is_protected = areas_ini.value("protected_area", "false").toBool();
@ -44,6 +45,7 @@ AreaData::AreaData(QString p_name, int p_index) :
showname_allowed = areas_ini.value("shownames_allowed", "true").toBool();
areas_ini.endGroup();
QSettings config_ini("config/config.ini", QSettings::IniFormat);
config_ini.setIniCodec("UTF-8");
config_ini.beginGroup("Options");
int log_size = config_ini.value("logbuffer", 50).toInt();
log_type = config_ini.value("logger","modcall").toString();

View File

@ -21,6 +21,7 @@
bool ConfigManager::initConfig()
{
QSettings config("config/config.ini", QSettings::IniFormat);
config.setIniCodec("UTF-8");
QFileInfo config_dir_info("config/");
if (!config_dir_info.exists() || !config_dir_info.isDir()) {
qCritical() << "Config directory doesn't exist!";
@ -39,6 +40,7 @@ bool ConfigManager::initConfig()
}
else {
QSettings areas_ini("config/areas.ini", QSettings::IniFormat);
areas_ini.setIniCodec("UTF-8");
if (areas_ini.childGroups().length() < 1) {
qCritical() << "areas.ini is invalid!";
return false;
@ -105,6 +107,7 @@ bool ConfigManager::initConfig()
bool ConfigManager::updateConfig(int current_version)
{
QSettings config("config/config.ini", QSettings::IniFormat);
config.setIniCodec("UTF-8");
if (current_version > CONFIG_VERSION) {
// Config version is newer than the latest version, and the config is
// invalid This could also mean the server is out of date, and the user
@ -137,6 +140,7 @@ bool ConfigManager::updateConfig(int current_version)
bool ConfigManager::loadServerSettings(server_settings* settings)
{
QSettings config("config/config.ini", QSettings::IniFormat);
config.setIniCodec("UTF-8");
bool port_conversion_success;
bool ws_port_conversion_success;
bool local_port_conversion_success;