boost::log::keywords::open_mode = std::ios::app\r
);\r
\r
- // TODO: does not seem to affect the character set only date formatting\r
- file_sink->locked_backend()->imbue(caspar::get_narrow_locale());\r
- // TODO: when UTF-8 log file output is fixed we can enable this\r
- bool print_all_characters = false;\r
+ bool print_all_characters = true;\r
\r
file_sink->locked_backend()->set_formatter(boost::bind(my_formatter, print_all_characters, _1, _2));\r
\r
return str ;\r
}\r
\r
-std::locale get_narrow_locale()\r
-{\r
- boost::locale::generator gen;\r
-\r
- gen.locale_cache_enabled(true);\r
-\r
- // TODO: make configurable?\r
- return gen.generate("en_GB.UTF-8");\r
-}\r
-\r
}
\ No newline at end of file
#pragma once\r
\r
#include <string>\r
-#include <locale>\r
#include <boost/lexical_cast.hpp>\r
\r
namespace caspar {\r
std::wstring widen(const std::wstring& str);\r
std::string narrow(const std::wstring& str); \r
std::string narrow(const std::string& str);\r
-std::locale get_narrow_locale();\r
\r
template <typename T>\r
inline T lexical_cast_or_default(const std::wstring str, T fail_value = T())\r
\r
//open file\r
std::wifstream datafile(filename.c_str());\r
- datafile.imbue(caspar::get_narrow_locale());\r
\r
if(datafile) \r
{\r
\r
//open file\r
std::wifstream datafile(filename.c_str());\r
- datafile.imbue(caspar::get_narrow_locale());\r
\r
if(datafile) \r
{\r
filename.append(_parameters[1]);\r
filename.append(TEXT(".ftd"));\r
\r
- std::wofstream datafile;\r
-\r
- datafile.imbue(caspar::get_narrow_locale());\r
- datafile.open(filename.c_str());\r
+ std::wofstream datafile(filename.c_str());\r
\r
if(!datafile) \r
{\r
\r
std::wifstream datafile(filename.c_str());\r
\r
- datafile.imbue(caspar::get_narrow_locale());\r
-\r
if(!datafile) \r
{\r
SetReplyString(TEXT("404 DATA RETRIEVE ERROR\r\n"));\r
#define NOMINMAX\r
#define WIN32_LEAN_AND_MEAN\r
\r
+#include <locale>\r
+\r
#include <windows.h>\r
#include <winnt.h>\r
#include <mmsystem.h>\r
#include <boost/property_tree/detail/file_parser_error.hpp>\r
#include <boost/property_tree/xml_parser.hpp>\r
#include <boost/foreach.hpp>\r
+#include <boost/locale.hpp>\r
\r
// NOTE: This is needed in order to make CComObject work since this is not a real ATL project.\r
CComModule _AtlModule;\r
::FreeLibrary(hMod);\r
}\r
\r
+void setup_global_locale()\r
+{\r
+ std::locale loc = boost::locale::generator()("");\r
+ std::locale::global(loc);\r
+}\r
+\r
void setup_console_window()\r
{ \r
auto hOut = GetStdHandle(STD_OUTPUT_HANDLE);\r
\r
SetUnhandledExceptionFilter(UserUnhandledExceptionFilter);\r
\r
+ setup_global_locale();\r
+\r
std::wcout << L"Type \"q\" to close application." << std::endl;\r
\r
// Set debug mode.\r