Sample program and test_in.ini for reading are attached. test_out is not provided since it will be generated automatically.
It is all about a string that contains certain special characters: "𠂇𠂉𠃌𡗗𢦏𤇾P1". Other than the 'P1' at the end, all characters are located at extended blocks of Unicode with 5-digit codepoint, i.e. U+200XX. I think the codepoint is the problem.
Please find the attached sample program. Change the paths given to settingsIn, settingsOut and settingsRead to wherever test_in.ini or test_out.ini is stored. Run the sample with the following configurations, one can find:
1. Comment out both macro UTF8 and READ_ENABLED so that no UTF-8 is assumed, and test_out is not read again after being written. It can be found that special characters are stored as \x sequence.
2. Uncomment READ_ENABLED to read test_out. Special characters are still stored as \x sequence but can be correctly read. Although qDebug cannot correctly print those characters, the string written into test_out is confirmed to be the same as original string in test_in because '==' test returns 'true'. So OK, even though special characters cannot be saved as they are, they can be read and used properly.
3. Uncomment UTF8 but comment out READ_ENABLE again. This time, only 'P1' is stored in test_out. It can also be confirmed from property, that the size of test_out is smaller than test_in. So this time, those special characters cannot be even saved.
4. Uncomment READ_ENABLED again to read test_out. Magically, \x sequence appears in test_out and can be read properly.
So QSettings magically works even if nothing is visible (or even existing?) in actual .ini file. How is that possible? And as mentioned, I think it is only related to certain very special characters. Common non-Latin characters works fine., i.e. being visible (in form of characters rather than \x sequence), readable and writable.
Those special characters work as expected in Qt6 though.