Merge pull request #102 from AttorneyOnline/fix/utf8
Update all QSettings instances to use UTF-8 to prevent problems with Cyrillic characters
This commit is contained in:
commit
01d4ff9048
@ -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();
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user