diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index c6fe19aee..ae345cceb 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -27,6 +27,7 @@ #include #include #include +#include // boost #include @@ -169,7 +170,12 @@ void datasource_cache::register_datasources(std::string const& str) if (mapnik::util::exists(str) && mapnik::util::is_directory(str)) { boost::filesystem::directory_iterator end_itr; +#ifdef _WINDOWS + std::wstring wide_dir(mapnik::utf8_to_utf16(str)); + for (boost::filesystem::directory_iterator itr(wide_dir); itr != end_itr; ++itr) +#else for (boost::filesystem::directory_iterator itr(str); itr != end_itr; ++itr ) +#endif { #if (BOOST_FILESYSTEM_VERSION == 3) diff --git a/src/font_engine_freetype.cpp b/src/font_engine_freetype.cpp index 7a97babf2..3d60fa25c 100644 --- a/src/font_engine_freetype.cpp +++ b/src/font_engine_freetype.cpp @@ -26,6 +26,7 @@ #include #include #include +#include // boost #include @@ -130,7 +131,11 @@ bool freetype_engine::register_font(std::string const& file_name) bool freetype_engine::register_font_impl(std::string const& file_name, FT_LibraryRec_ * library) { - std::ifstream file(file_name.c_str() , std::ios::binary); +#ifdef _WINDOWS + std::ifstream file(mapnik::utf8_to_utf16(file_name), std::ios::binary); +#else + std::ifstream file(file_name.c_str(), std::ios::binary); +#endif if (!file.good()) { return false; } @@ -227,12 +232,23 @@ bool freetype_engine::register_fonts_impl(std::string const& dir, FT_LibraryRec_ try { boost::filesystem::directory_iterator end_itr; +#ifdef _WINDOWS + std::wstring wide_dir(mapnik::utf8_to_utf16(dir)); + for (boost::filesystem::directory_iterator itr(wide_dir); itr != end_itr; ++itr) + { + #if (BOOST_FILESYSTEM_VERSION == 3) + std::string file_name = mapnik::utf16_to_utf8(itr->path().wstring()); + #else // v2 + std::string file_name = mapnik::utf16_to_utf8(itr->wstring()); + #endif +#else for (boost::filesystem::directory_iterator itr(dir); itr != end_itr; ++itr) { #if (BOOST_FILESYSTEM_VERSION == 3) std::string file_name = itr->path().string(); #else // v2 std::string file_name = itr->string(); +#endif #endif if (boost::filesystem::is_directory(*itr) && recurse) {