Force LC_CTYPE to en_US.UTF-8 on OS X

When run from an app bundle the locale environment variables are unset,
and the default locale settings are bogus as a result.
This commit is contained in:
Thomas Goyne 2012-08-26 19:13:11 -07:00
parent 4cb5d411b3
commit 9f8e25ed0a

View file

@ -202,8 +202,13 @@ FrameMain::FrameMain (wxArrayString args)
setlocale(LC_NUMERIC, "C");
#endif
#ifdef __APPLE__
// Apple's wprintf() and family breaks with CTYPE set to "C"
setlocale(LC_CTYPE, "");
// When run from an app bundle, LC_CTYPE defaults to "C", which breaks on
// anything involving unicode and in some cases number formatting.
// The right thing to do here would be to query CoreFoundation for the user's
// locale and add .UTF-8 to that, but :effort:
LOG_D("locale") << setlocale(LC_ALL, 0);
setlocale(LC_CTYPE, "en_US.UTF-8");
LOG_D("locale") << setlocale(LC_ALL, 0);
#endif
StartupLog("Initializing context models");