Hi all,
I need to write some config changes out to an ini file (DefaultGame.ini) at runtime. This is for configuring server details.
I have a custom UDeveloperSettings class to store my custom config, and ensure my server config is kept under its own header in DefaultGame.ini
This is how I am writing out the config currently:
UMyConfigSettings* ConfigSettings = GetMutableDefault<UMyConfigSettings>();
// Change the contents of ConfigSettings as necessary
ConfigSettings->SaveConfig();
ConfigSettings->UpdateDefaultConfigFile();
The problem I have is that UE4 writes the file out in the wrong format, which ends up corrupting the DefaultGame.ini on a Linux dedicated server. I confirmed this by checking the ini file before and after I ran the code. Before, it was UTF-8 as expected for Linux. After, it had been encoded in UTF-16, which Linux doesn’t support.
I have tried ensuring all strings are converted to UTF-8 through using the TCHAR_TO_UTF8 macro, but I don’t think that is the problem: its how UE4 writes the ini file.
How do I ensure the output is in UTF-8? I cant find anything online about this…
Thanks!