+ // Command-line arguments are supposed to be in the user locale encoding
+ // (what else?) but wxLocale probably wasn't initialized yet as we're
+ // called early during the program startup and so our locale might not have
+ // been set from the environment yet. To work around this problem we
+ // temporarily change the locale here. The only drawback is that changing
+ // the locale is thread-unsafe but precisely because we're called so early
+ // it's hopefully safe to assume that no other threads had been created yet.
+ char * const locOld = SetAllLocaleFacets("");
+ wxON_BLOCK_EXIT1( SetAllLocaleFacets, locOld );
+