On Fri, Aug 15, 2014 at 8:54 AM, Peter Bindels
Hi all,
When trying to use a global constructor to set the locale to utf8 for an entire project, the system failed to start due to global constructor ordering making the override happen before the std::locale object itself was initialized.
Looking into the boost::filesystem code for imbue it seemed that there were a few different implementations, one of which could work. I've tried to keep the same side conditions and made this same lazy-initialization approach for all platforms, which should keep working in all the same conditions and also work for a global constructor overriding the locale. I've attached the patch.
I hope that this change can be integrated into boost::filesystem or that we can have a constructive discussion on what solution we should be making.
There have been a number of filesystem tickets related to locales and/or codecvt facets. Tickets 8352, 9054, and 10228 are now fixed on the develop branch and more will be fixed for 1.57.0. Other changes are underway to incorporate the Filesystem TS now being voted on by ISO, and that has a major impact on some aspects of the filesystem codebase. So submitting a random patch against 1.55.0 without a test program or indication of platforms the patch has been tested against isn't very helpful. What would be helpful is to watch the develop branch, and as the various fixes go in submit test cases if the fix fails for you. Thanks, --Beman