From 9f8e25ed0ade153bca0c22ddf4aa76111d078703 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 26 Aug 2012 19:13:11 -0700 Subject: [PATCH] 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. --- aegisub/src/frame_main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index 0eb0efaca..270167f45 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -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");