From 1d90cda8f378b4eb2fe2be06e54e9937aa7440a9 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 12 Jan 2014 09:53:24 -0800 Subject: [PATCH] Fix codecvt errors on OS X When launching Aegisub from Finder (but not via open), using the UTF-8 version of the locale breaks things for whatever reason, but fortunately it's unneccesary as paths on OS X are always UTF-8 even if the locale isn't. Closes #1685. --- aegisub/src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index 3f4517f3a..1080e376d 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -118,7 +118,15 @@ bool AegisubApp::OnInit() { // Set the global locale to the utf-8 version of the current locale std::locale::global(boost::locale::generator().generate("")); + +#ifndef __APPLE__ + // Boost.FileSystem always uses UTF-8 for paths on OS X (since paths + // actually are required to be UTF-8 strings rather than just opaque binary + // blobs like on Linux), so there's no need to imbue the new locale and in + // fact it actively breaks things for unknown reasons when launching the + // app from Finder (but not from the command line). boost::filesystem::path::imbue(std::locale()); +#endif // Pointless `this` capture required due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51494 agi::dispatch::Init([this](agi::dispatch::Thunk f) {