forked from mia/Aegisub
Ensure boost.locale is initialized with a UTF-8 locale on OS X
This fixes the find/replace dialog stripping non-us-ascii characters from the file. See #1587 for the same issue on Windows.
This commit is contained in:
parent
489eca221d
commit
dcf1270fc4
1 changed files with 7 additions and 8 deletions
15
src/main.cpp
15
src/main.cpp
|
@ -121,18 +121,17 @@ bool AegisubApp::OnInit() {
|
||||||
// be created now
|
// be created now
|
||||||
(void)wxLog::GetActiveTarget();
|
(void)wxLog::GetActiveTarget();
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
// When launched from Finder, boost::locale fails to get the correct locale
|
||||||
|
// and falls back to "C", which of course doesn't support unicode
|
||||||
|
std::locale::global(boost::locale::generator().generate("en_US.UTF-8"));
|
||||||
|
#else
|
||||||
// Set the global locale to the utf-8 version of the current locale
|
// Set the global locale to the utf-8 version of the current locale
|
||||||
std::locale::global(boost::locale::generator().generate(""));
|
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
|
#endif
|
||||||
|
|
||||||
|
boost::filesystem::path::imbue(std::locale());
|
||||||
|
|
||||||
// Pointless `this` capture required due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51494
|
// Pointless `this` capture required due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51494
|
||||||
agi::dispatch::Init([this](agi::dispatch::Thunk f) {
|
agi::dispatch::Init([this](agi::dispatch::Thunk f) {
|
||||||
auto evt = new wxThreadEvent(EVT_CALL_THUNK);
|
auto evt = new wxThreadEvent(EVT_CALL_THUNK);
|
||||||
|
|
Loading…
Reference in a new issue