From 271c7cabf5e16a1afed560b9f707b3955b3ec725 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 28 Jan 2010 11:32:39 +0100 Subject: converted all strings and chars to wstrings and wchar_ts all strings with displayable content are now the wide strings for proper unicode handling added boost dependency for proper reading unicode from files --- src/utils/file.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/utils/file.cpp') diff --git a/src/utils/file.cpp b/src/utils/file.cpp index 3aeb4fc5..a7fc87e8 100644 --- a/src/utils/file.cpp +++ b/src/utils/file.cpp @@ -25,11 +25,18 @@ */ #include "file.hpp" +#include +#include + +#include namespace usdx { - File::File(const std::string& filename) : file(filename.c_str(), std::ifstream::in) + File::File(const std::string& filename) : file(filename.c_str(), std::wifstream::in) { + std::locale global_loc = std::locale(); + std::locale loc(global_loc, new boost::program_options::detail::utf8_codecvt_facet()); + file.imbue(loc); } File::~File(void) @@ -37,7 +44,7 @@ namespace usdx file.close(); } - std::istream &File::stream(void) + std::wistream &File::stream(void) { return file; } -- cgit v1.2.3