PDA

View Full Version : Edit INI File: problems with UTF8 and ANSI files



nicjedi
03-18-2016, 02:19 AM
Hello guys,
I have a big problem in our installation script:
we are passed few years ago from ANSI to UTF-8 in our software, so all our text files ( also INI) are automatically converted in UTF-8 first time they are opened by one of our software.
Last month we found errors on some old ANSI ini files after and update to newer version, and after a big amount of debug we found that the problem is the Edit INI file command of setupbuilder.
Is possible that, due the fact that the "new" file we save in the installer is written in UTF-8, the Edit INI file command save text written in UTF-8 also if the file opened is ANSI?
Thats because, if we upgrade the version, we do not overwrite the INI file, so it's still an ANSI file.

Hope you can help me

Nicola

linder
03-18-2016, 03:39 AM
Nicola,

The installer makes use of the standard Windows APIs to read and write INI files (e.g. GetPrivateProfileStringA). The native INI handling (ANSI) Windows APIs can only support ANSI coded files. They do not support UTF-8 encoded files and this is by Windows design! The INI functionality in Windows is only there to provide backward compatibility. The Windows INI file format does not support UTF-8.

Friedrich