aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/file.cpp
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2010-01-28 11:32:39 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-05 17:17:46 +0100
commit271c7cabf5e16a1afed560b9f707b3955b3ec725 (patch)
tree026b6678c6973205e32698af795830d58c5121d6 /src/utils/file.cpp
parent2adaea29500b412c342838e22df2f8b4ac2eb02d (diff)
downloadusdx-271c7cabf5e16a1afed560b9f707b3955b3ec725.tar.gz
usdx-271c7cabf5e16a1afed560b9f707b3955b3ec725.tar.xz
usdx-271c7cabf5e16a1afed560b9f707b3955b3ec725.zip
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
Diffstat (limited to 'src/utils/file.cpp')
-rw-r--r--src/utils/file.cpp11
1 files changed, 9 insertions, 2 deletions
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 <string>
+#include <locale>
+
+#include <boost/program_options/detail/utf8_codecvt_facet.hpp>
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;
}