We currently face the problem that an external component (we unfortunately don't know which one) that is loaded when using the Windows file open/save dialog one some systems changes the locale of the process, probably by making the call setlocale(LC_ALL, "")
.
This messes up our application, because it relies on the standard locale being set (which is not changed by any of our own components during runtime).
So we need to make sure that either setlocale()
never has any effect when called within the process, or we need to detect whenever this function is called and then reset the locale to the default "C" locale.
Is there a way to achieve either of these goals?
This is not really a direct answer to the question, but a solution for the underlying problem. It turned out that a recent update to iCloud caused this issue, see this post for example:
https://discussions.apple.com/thread/5356698
So there are two solutions, one renaming the ShellStreams.dll
, the other one is uninstalling iClould completely (if it's not used anyway).
An actual protection that could be used is making setlocale()
just thread-global instead of process-global:
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)
It worked in a simple test application of ours, but not in the real world case (so not an actual solution for us).
The most reliable way to solve this problem if you cannot uninstall iCloud is to use the "_l"-functions, which work using a specific locale like this:
_locale_t localeInfo = _create_locale(LC_NUMERIC, "C");
_sprintf_l(string, format, localeInfo, number);
_free_locale(localeInfo);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With