We are using a tool that uses internally the simple Win-Api call WritePrivateProfileString
.
I'm aware of the define flag UNICODE to map either to WritePrivateProfileString**A**
or WritePrivateProfileString**W**
I am writing something to the INI file, that file doesn't exist before.
And it behaves differently on some systems. Why?
For example: a character "§" which is A7 (hex) in ASCI, is sometimes written as Unicode format C2 A7 (hex). but only on some systems, and I don't know WHY?! What is the system-condition for writing ANSI or UNICODE?
I was trying to create the file first, before writing to it and even tried to define the format, by adding some characters already, cause I thought WritePrivateProfileString
is using isTextUnicode
internally,
but no chance here.
Does anybody understand this API-Documentation in the right way:
https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-writeprivateprofilestringa
If the file was created using Unicode characters, the function writes Unicode characters to the file. Otherwise, the function writes ANSI characters.
I can not really agree to this documentation here. I know I must be wrong here somehow ;-) Or how to do that right?
All that we want is to write in ANY case to ANY system just plain ANSI to the INI-file. (I can't change it to the method WritePrivateProfileString**A**
cause we are using a tool that just uses the WritePrivateProfileString
function internally.) Anyhow, it works for 90% of the PC's out there correct, but on some we have still unicode letters in the INI file.
I also know ASCI is not state-of-the-art, but we are performing some CRC-calculation of that INI values and "A7" is not "C2 A7", which leads to a miss-calculation, that's the background why we need plain ASCII format.
Thank you for any help.