Both of these articles state "If the file exists and was created using Unicode characters, the function writes Unicode characters to
the file. Otherwise, the function creates a file using ANSI characters."
Joseph M. Newcomer wrote:
The error appears to be that it is not documented that it does this. I have no problem
with the design, but it needs to say that. According to the cited article, this fact is
not documented.
Note that I primarily am reporting errors of documentation. Sometimes I point out that
the design is flawed. But mostly, it is the omission of crtical information that should
have been written down.
The issue of "carrying settings around" sometimes suggests .INI files, so more people use
them than Microsoft intended. So the reality is that this behavior needs to be
documented, and the failure to provide clear documentation of this interesting behavior is
the "error" I want to cite.
joe
On Sat, 22 Aug 2009 15:50:37 -0500, Scot T Brennecke <ScotB@Spamhater.MVPs.org> wrote:
Come on, Joe. It's not an error. It's by design, and documented. Furthermore, it states this: "Note This function is provided
only for compatibility with 16-bit versions of Windows. Applications should store initialization information in the registry." back
in 16-bit days, we didn't even have Unicode.
Joseph M. Newcomer wrote:
Fascinating! Could I incorporate parts of that article into my MSDN Errors document, with
a hyperlink to your document?
joe
On Sat, 22 Aug 2009 01:04:10 -0700, "Mihai N." <nmihai_year_2000@yahoo.com> wrote:
Can i use GetPrivateProfileString/WritePrivateProfileString to read/
write unicode strings from a file ?
Trick: if the file does not exist, or exists but it is not Unicode, then
the functions will convert everything to ANSI.
If you want to be unicode, then create an empty file with a BOM only
(FE FF) and then everything you write will be Unicode.
http://blogs.msdn.com/michkap/archive/2006/09/15/754992.aspx
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm