Thanks for pointing me in the right direction. I ended up using UTF-8
and
creating a file in two steps as follows:
errno_t nErrno = _wfopen_s(&fp, pszPath, L"w");
if (0 == nErrno) {
fputws(L"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n", fp);
fclose(fp);
nErrno = _wfopen_s(&fp, pszPath, L"a, ccs=UTF-8");
}
I really don't see the need for two steps.
nErrno = _wfopen_s(&fp, pszPath, L"w, ccs=UTF-8");
if (0 == nErrno) {
fputws(L"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n", fp);
// here you can do everything you want
fclose(fp);
}
should do.
--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
I actually I did try the one-step solution first after Giovanni's reply.
The file always ended up with BOM which - according to docs - was correct.
with BOM in front of XML declaration.