Index: src/widgets/file_menu.cpp
===================================================================
--- src/widgets/file_menu.cpp	(revision 56042)
+++ src/widgets/file_menu.cpp	(working copy)
@@ -84,7 +84,7 @@
 }
 
 int file_menu::delete_chosen_file() {
-	const int ret = remove(chosen_file_.c_str());
+	const int ret = remove(system_filename(chosen_file_));
 	if (ret == -1) {
 	//	gui2::show_transient_message(disp_.video(), "", _("Deletion of the file failed."));
 	}
Index: src/sound.cpp
===================================================================
--- src/sound.cpp	(revision 56042)
+++ src/sound.cpp	(working copy)
@@ -480,7 +480,7 @@
 	std::map<std::string,Mix_Music*>::const_iterator itor = music_cache.find(filename);
 	if(itor == music_cache.end()) {
 		LOG_AUDIO << "attempting to insert track '" << filename << "' into cache\n";
-		Mix_Music* const music = Mix_LoadMUS(filename.c_str());
+		Mix_Music* const music = Mix_LoadMUS(system_filename(filename));
 		if(music == NULL) {
 			ERR_AUDIO << "Could not load music file '" << filename << "': "
 					  << Mix_GetError() << "\n";
@@ -691,7 +691,7 @@
 		std::string const &filename = get_binary_file_location("sounds", file);
 
 		if (!filename.empty()) {
-			temp_chunk.set_data(Mix_LoadWAV(filename.c_str()));
+			temp_chunk.set_data(Mix_LoadWAV(system_filename(filename)));
 		} else {
 			ERR_AUDIO << "Could not load sound file '" << file << "'.\n";
 			throw chunk_load_exception();
Index: src/font.cpp
===================================================================
--- src/font.cpp	(revision 56042)
+++ src/font.cpp	(working copy)
@@ -227,7 +227,7 @@
 		}
 	}
 
-	TTF_Font* font = TTF_OpenFont(name.c_str(),size);
+	TTF_Font* font = TTF_OpenFont(system_filename(name),size);
 	if(font == NULL) {
 		ERR_FT << "Failed opening font: TTF_OpenFont: " << TTF_GetError() << "\n";
 		return NULL;
@@ -347,8 +347,9 @@
 void manager::init() const
 {
 #ifdef CAIRO_HAS_FT_FONT
+	const system_filename font_dir(game_config::path + "/fonts");
 	if (!FcConfigAppFontAddDir(FcConfigGetCurrent(),
-		reinterpret_cast<const FcChar8 *>((game_config::path + "/fonts").c_str())))
+		reinterpret_cast<const FcChar8 *>(font_dir.c_str())))
 	{
 		ERR_FT << "Could not load the true type fonts\n";
 		throw error();
@@ -361,7 +362,7 @@
 		get_files_in_dir(path, &files, NULL, ENTIRE_FILE_PATH);
 		BOOST_FOREACH(const std::string& file, files)
 			if(file.substr(file.length() - 4) == ".ttf" || file.substr(file.length() - 4) == ".ttc")
-				AddFontResource(file.c_str());
+				AddFontResource(system_filename(file));
 	}
 #endif
 }
@@ -378,7 +379,7 @@
 		get_files_in_dir(path, &files, NULL, ENTIRE_FILE_PATH);
 		BOOST_FOREACH(const std::string& file, files)
 			if(file.substr(file.length() - 4) == ".ttf" || file.substr(file.length() - 4) == ".ttc")
-				RemoveFontResource(file.c_str());
+				RemoveFontResource(system_filename(file));
 	}
 #endif
 }
Index: src/filesystem.hpp
===================================================================
--- src/filesystem.hpp	(revision 56042)
+++ src/filesystem.hpp	(working copy)
@@ -277,4 +277,66 @@
 	~scoped_ostream();
 };
 
+/**
+ * This is a data conversion class that converts between the program's preferred
+ * encoding (UTF-8) and the file system's encoding. The typical use of this class
+ * would be as a temporary object when interacting with the OS's interface for
+ * files. Use this to convert between C-style strings and std::string.
+ * For example: std::string name(system_filename(buf));
+ * For example: opendir(system_filename(name));
+ * The basic idea is that (outside this class) a std::string will be in UTF-8
+ * encoding, while a C-style string will be in file system encoding.
+ */
+class system_filename {
+	/// The string in file system encoding.
+	const std::string data_;
+public:
+	///Constructor from a C-style string provided by the operating system.
+	explicit system_filename(const char * src) : data_(src) {}
+	/// Constructor from a std::string, assuming UTF-8 encoding.
+	explicit system_filename(const std::string & src) :
+		data_(convert(src, UTF_TO_FS))
+	{}
+
+	/// Conversion to a C-style string to be given to system calls.
+	/// This produces file system encoding.
+	operator const char *() const { return data_.c_str(); }
+	/// Conversion to a std::string for use within the program.
+	/// (This produces a temporary string, so behavior may be undefined if it
+	/// is not immediately assigned to a named variable. Be particularly
+	/// careful if not developing on Windows, as bugs from this undefined
+	/// behavior very well might be visible only under Windows.)
+	operator std::string()  const { return convert(data_, FS_TO_UTF); }
+
+	/// Explicit conversion to C-style string.
+	const char * c_str() const { return data_.c_str(); }
+	/// Explicit conversion to std::string.
+	/// (This is needed if assigning to a string, rather than constructing one.)
+	std::string str()    const { return convert(data_, FS_TO_UTF); }
+
+	/// Append a C-style string.
+	/// It is assumed the C-style string is in filesystem encoding, if needed.
+	/// (The intended use case is appending a string literal that needs no
+	/// special encoding, such as appending "/data".)
+	system_filename operator+(const char * s) const
+	{ return system_filename( (data_ + s).c_str() ); }
+	/// Append a std::string (assumed UTF-8).
+	system_filename operator+(const std::string & s) const
+	{ return system_filename( (data_ + convert(s, UTF_TO_FS)).c_str() ); }
+	/// Append a system_filename.
+	system_filename operator+(const system_filename & s) const
+	{ return system_filename( (data_ + s.data_).c_str() ); }
+
+private:
+	enum CONVERSION { UTF_TO_FS, FS_TO_UTF };
+	/// Converts @a src between UTF-8 and file system encoding.
+#ifdef _WIN32
+	static std::string convert(const std::string & src, CONVERSION direction);
+#else
+	// Else, no special conversion is needed.
+	static std::string convert(const std::string & src, CONVERSION)
+	{ return src; }
 #endif
+};
+
+#endif
Index: src/savegame.hpp
===================================================================
--- src/savegame.hpp	(revision 56042)
+++ src/savegame.hpp	(working copy)
@@ -296,7 +296,4 @@
 
 } //end of namespace savegame
 
-void replace_underbar2space(std::string &name);
-void replace_space2underbar(std::string &name);
-
 #endif
Index: src/display.cpp
===================================================================
--- src/display.cpp	(revision 56042)
+++ src/display.cpp	(working copy)
@@ -21,6 +21,7 @@
 #include "builder.hpp"
 #include "cursor.hpp"
 #include "display.hpp"
+#include "filesystem.hpp"
 #include "game_preferences.hpp"
 #include "gettext.hpp"
 #include "halo.hpp"
@@ -727,7 +728,7 @@
 	int size = 0;
 	if (!map_screenshot) {
 		surface screenshot_surf = screen_.getSurface();
-		SDL_SaveBMP(screenshot_surf, filename.c_str());
+		SDL_SaveBMP(screenshot_surf, system_filename(filename));
 		size = screenshot_surf->w * screenshot_surf->h;
 	} else {
 		if (get_map().empty()) {
@@ -759,7 +760,7 @@
 		draw(true,true);
 
 		// finally save the image on disk
-		SDL_SaveBMP(map_screenshot_surf_, filename.c_str());
+		SDL_SaveBMP(map_screenshot_surf_, system_filename(filename));
 
 		//NOTE: need to be sure that we free this huge surface (is it enough?)
 		map_screenshot_surf_ = NULL;
Index: src/game_display.cpp
===================================================================
--- src/game_display.cpp	(revision 56042)
+++ src/game_display.cpp	(working copy)
@@ -34,6 +34,7 @@
 Growl_Delegate growl_obj;
 #endif
 
+#include "filesystem.hpp"
 #include "game_preferences.hpp"
 #include "halo.hpp"
 #include "log.hpp"
@@ -930,8 +931,8 @@
 			DBUS_TYPE_STRING, &event_id,
 			DBUS_TYPE_INVALID);
 	}
-	std::string app_icon_ = game_config::path + "/images/wesnoth-icon-small.png";
-	const char *app_icon = app_icon_.c_str();
+	const system_filename app_icon_path(game_config::path + "/images/wesnoth-icon-small.png");
+	const char *app_icon = app_icon_path.c_str();
 	const char *summary = owner.c_str();
 	const char *body = message.c_str();
 	const char **actions = NULL;
Index: src/network_worker.cpp
===================================================================
--- src/network_worker.cpp	(revision 56042)
+++ src/network_worker.cpp	(working copy)
@@ -497,7 +497,7 @@
 		buffer.resize(4);
 		SDLNet_Write32(filesize,&buffer[0]);
 		int socket = reinterpret_cast<_TCPsocket*>(buf->sock)->channel;
-		const scoped_fd in_file(open(buf->config_error.c_str(), O_RDONLY));
+		const scoped_fd in_file(open(system_filename(buf->config_error), O_RDONLY));
 		cork_setter set_socket_cork(socket);
 		int poll_res;
 		struct pollfd fd = {socket, POLLOUT, 0 };
Index: src/filesystem.cpp
===================================================================
--- src/filesystem.cpp	(revision 56042)
+++ src/filesystem.cpp	(working copy)
@@ -54,6 +54,21 @@
 // for strerror
 #include <cstring>
 
+// support for system_filename::convert()
+#ifdef _WIN32
+	#ifdef INADDR_ANY
+		#undef INADDR_ANY
+	#endif
+	#ifdef INADDR_BROADCAST
+		#undef INADDR_BROADCAST
+	#endif
+	#ifdef INADDR_NONE
+		#undef INADDR_NONE
+	#endif
+
+	#include <windows.h>
+#endif
+
 #include "config.hpp"
 #include "filesystem.hpp"
 #include "game_config.hpp"
@@ -65,6 +80,7 @@
 #include "version.hpp"
 
 #include <boost/foreach.hpp>
+#include <boost/scoped_array.hpp>
 
 static lg::log_domain log_filesystem("filesystem");
 #define DBG_FS LOG_STREAM(debug, log_filesystem)
@@ -88,6 +104,26 @@
 #include <CoreFoundation/CFBase.h>
 #endif
 
+
+/**
+ * A convenience wrapper for stat() that handles filename encoding.
+ * Use this just like stat(), except the first parameter is a std::string
+ * instead of a C-style string.
+ */
+inline int stat(const std::string & path, struct stat * buf)
+{
+	return ::stat(system_filename(path).c_str(), buf);
+}
+/**
+ * A wrapper for stat() that disambiguates explicit use of system_filename.
+ * Not really needed, but can save some headaches while coding.
+ */
+inline int stat(const system_filename & path, struct stat * buf)
+{
+	return ::stat(path.c_str(), buf);
+}
+
+
 bool ends_with(const std::string& str, const std::string& suffix)
 {
 	return str.size() >= suffix.size() && std::equal(suffix.begin(),suffix.end(),str.end()-suffix.size());
@@ -128,7 +164,7 @@
 		else
 			maincfg = (directory + "/") + maincfg_filename;
 
-		if (::stat(maincfg.c_str(), &st) != -1) {
+		if ( ::stat(maincfg, &st) != -1 ) {
 			LOG_FS << "_main.cfg found : " << maincfg << '\n';
 			if (files != NULL) {
 				if (mode == ENTIRE_FILE_PATH)
@@ -140,7 +176,7 @@
 		}
 	}
 
-	DIR* dir = opendir(directory.c_str());
+	DIR* dir = opendir(system_filename(directory));
 
 	if(dir == NULL) {
 		return;
@@ -181,7 +217,7 @@
 		else
 			fullname = directory + "/" + basename;
 
-		if (::stat(fullname.c_str(), &st) != -1) {
+		if ( ::stat(fullname, &st) != -1 ) {
 			if (S_ISREG(st.st_mode)) {
 				if(filter == SKIP_PBL_FILES && looks_like_pbl(basename)) {
 					continue;
@@ -205,7 +241,7 @@
 					continue;
 
 				if (reorder == DO_REORDER &&
-						::stat((fullname+"/"+maincfg_filename).c_str(), &st)!=-1 &&
+						::stat(fullname+"/"+maincfg_filename, &st)!=-1 &&
 						S_ISREG(st.st_mode)) {
 					LOG_FS << "_main.cfg found : ";
 					if (files != NULL) {
@@ -363,11 +399,13 @@
 
 std::string get_dir(const std::string& dir_path)
 {
-	DIR* dir = opendir(dir_path.c_str());
+	// Minor optimization: we only need to convert to system encoding once.
+	const system_filename converted_path(dir_path);
+	DIR* dir = opendir(converted_path);
 	if(dir == NULL) {
-		const int res = mkdir(dir_path.c_str(),AccessMode);
+		const int res = mkdir(converted_path, AccessMode);
 		if(res == 0) {
-			dir = opendir(dir_path.c_str());
+			dir = opendir(converted_path);
 		} else {
 			ERR_FS << "could not open or create directory: " << dir_path << '\n';
 		}
@@ -383,7 +421,7 @@
 
 bool make_directory(const std::string& path)
 {
-	return (mkdir(path.c_str(),AccessMode) == 0);
+	return  mkdir(system_filename(path), AccessMode) == 0;
 }
 
 bool looks_like_pbl(const std::string& file)
@@ -404,7 +442,7 @@
 	if(!files.empty()) {
 		for(std::vector<std::string>::const_iterator i = files.begin(); i != files.end(); ++i) {
 			errno = 0;
-			if(remove((*i).c_str()) != 0) {
+			if ( remove(system_filename(*i)) != 0 ) {
 				LOG_FS << "remove(" << (*i) << "): " << strerror(errno) << "\n";
 				ret = false;
 			}
@@ -427,7 +465,7 @@
 	else
 		remove = ::remove;
 #endif
-	if(remove(path.c_str()) != 0) {
+	if ( remove(system_filename(path)) != 0 ) {
 		LOG_FS << "remove(" << path << "): " << strerror(errno) << "\n";
 		ret = false;
 	}
@@ -439,13 +477,7 @@
 	char buf[1024];
 	const char* const res = getcwd(buf,sizeof(buf));
 	if(res != NULL) {
-		std::string str(res);
-
-#ifdef _WIN32
-		std::replace(str.begin(),str.end(),'\\','/');
-#endif
-
-		return str;
+		return system_filename(res);
 	} else {
 		return "";
 	}
@@ -459,7 +491,7 @@
 	if(path_size == static_cast<size_t>(-1))
 		return std::string();
 	buf[path_size] = 0;
-	return std::string(dirname(buf));
+	return system_filename(dirname(buf));
 #else
 	return get_cwd();
 #endif
@@ -547,8 +579,7 @@
 			LOG_FS << "Using SHGetSpecialFolderPath to find My Documents\n";
 			char my_documents_path[MAX_PATH];
 			if(SHGetSpecialFolderPath(NULL, my_documents_path, 5, 1)) {
-				std::string mygames_path = std::string(my_documents_path) + "/" + "My Games";
-				boost::algorithm::replace_all(mygames_path, std::string("\\"), std::string("/"));
+				std::string mygames_path = system_filename(my_documents_path) + "/" + "My Games";
 				create_directory_if_missing(mygames_path);
 				game_config::preferences_dir = mygames_path + "/" + path;
 			} else {
@@ -579,16 +610,16 @@
 				path = path2;
 				goto other;
 			}
-			user_data_dir = home_str;
+			user_data_dir = system_filename(home_str).str();
 			user_data_dir += "/.local/share";
-		} else user_data_dir = xdg_data;
+		} else user_data_dir = system_filename(xdg_data).str();
 		user_data_dir += "/wesnoth/";
 		user_data_dir += get_version_path_suffix();
 		create_directory_if_missing_recursive(user_data_dir);
 		game_config::preferences_dir = user_data_dir;
 	} else {
 		other:
-		std::string home = home_str ? home_str : ".";
+		std::string home = system_filename(home_str ? home_str : ".");
 
 		if (path[0] == '/')
 			game_config::preferences_dir = path;
@@ -612,7 +643,7 @@
 	}
 #else
 	const char* home_str = getenv("HOME");
-	std::string home = home_str ? home_str : ".";
+	std::string home = system_filename(home_str ? home_str : ".");
 
 	if (path[0] == '/')
 		game_config::preferences_dir = path;
@@ -629,13 +660,14 @@
 static void setup_user_data_dir()
 {
 #ifdef _WIN32
-	_mkdir(user_data_dir.c_str());
-	_mkdir((user_data_dir + "/editor").c_str());
-	_mkdir((user_data_dir + "/editor/maps").c_str());
-	_mkdir((user_data_dir + "/data").c_str());
-	_mkdir((user_data_dir + "/data/add-ons").c_str());
-	_mkdir((user_data_dir + "/saves").c_str());
-	_mkdir((user_data_dir + "/persist").c_str());
+	const system_filename dir_name(user_data_dir);
+	_mkdir(dir_name);
+	_mkdir(dir_name + "/editor");
+	_mkdir(dir_name + "/editor/maps");
+	_mkdir(dir_name + "/data");
+	_mkdir(dir_name + "/data/add-ons");
+	_mkdir(dir_name + "/saves");
+	_mkdir(dir_name + "/persist");
 #elif defined(__BEOS__)
 	BPath tpath;
 	#define BEOS_CREATE_PREFERENCES_SUBDIR(subdir) \
@@ -655,7 +687,7 @@
 
 	const bool res = create_directory_if_missing(dir_path);
 	// probe read permissions (if we could make the directory)
-	DIR* const dir = res ? opendir(dir_path.c_str()) : NULL;
+	DIR* const dir = res ? opendir(system_filename(dir_path)) : NULL;
 	if(dir == NULL) {
 		ERR_FS << "could not open or create preferences directory at " << dir_path << '\n';
 		return;
@@ -755,7 +787,7 @@
 		return s;
 	}
 
-	std::ifstream *s = new std::ifstream(fname.c_str(),std::ios_base::binary);
+	std::ifstream *s = new std::ifstream(system_filename(fname), std::ios_base::binary);
 	if (s->is_open())
 		return s;
 	ERR_FS << "Could not open '" << fname << "' for reading.\n";
@@ -772,14 +804,14 @@
 std::ostream *ostream_file(std::string const &fname)
 {
 	LOG_FS << "streaming " << fname << " for writing.\n";
-	return new std::ofstream(fname.c_str(), std::ios_base::binary);
+	return new std::ofstream(system_filename(fname), std::ios_base::binary);
 }
 
 // Throws io_exception if an error occurs
 void write_file(const std::string& fname, const std::string& data)
 {
-	//const util::scoped_resource<FILE*,close_FILE> file(fopen(fname.c_str(),"wb"));
-	const util::scoped_FILE file(fopen(fname.c_str(),"wb"));
+	//const util::scoped_resource<FILE*,close_FILE> file(fopen(system_filename(fname), "wb"));
+	const util::scoped_FILE file(fopen(system_filename(fname), "wb"));
 	if(file.get() == NULL) {
 		throw io_exception("Could not open file for writing: '" + fname + "'");
 	}
@@ -817,7 +849,7 @@
 {
 #ifdef _WIN32
 	_finddata_t info;
-	const long handle = _findfirst((fname + "/*").c_str(),&info);
+	const long handle = _findfirst(system_filename(fname + "/*"), &info);
 	if(handle >= 0) {
 		_findclose(handle);
 		return true;
@@ -827,7 +859,7 @@
 
 #else
 	struct stat dir_stat;
-	if(::stat(fname.c_str(), &dir_stat) == -1) {
+	if( ::stat(fname, &dir_stat) == -1 ) {
 		return false;
 	}
 	return S_ISDIR(dir_stat.st_mode);
@@ -850,18 +882,18 @@
 bool file_exists(const std::string& name)
 {
 #ifdef _WIN32
-       struct stat st;
-       return (::stat(name.c_str(), &st) == 0);
+	struct stat st;
+	return  ::stat(name, &st) == 0;
 #else
 	struct stat st;
-	return (::stat(name.c_str(), &st) != -1);
+	return  ::stat(name, &st) != -1;
 #endif
 }
 
 time_t file_create_time(const std::string& fname)
 {
 	struct stat buf;
-	if(::stat(fname.c_str(),&buf) == -1)
+	if( ::stat(fname, &buf) == -1 )
 		return 0;
 
 	return buf.st_mtime;
@@ -944,7 +976,7 @@
 int file_size(const std::string& fname)
 {
 	struct stat buf;
-	if(::stat(fname.c_str(),&buf) == -1)
+	if ( ::stat(fname, &buf) == -1 )
 		return -1;
 
 	return buf.st_size;
@@ -1352,3 +1384,62 @@
 {
 	delete stream;
 }
+
+
+#ifdef _WIN32
+/**
+ * Converts @a src between UTF-8 and file system encoding.
+ */
+std::string system_filename::convert(const std::string & src, CONVERSION direction)
+{
+	// Shorthand for the direction of conversion.
+	const bool a2u =  direction == FS_TO_UTF;
+
+	// Get the length of the source in wide characters.
+	int wlen = MultiByteToWideChar(a2u ? CP_ACP : CP_UTF8, 0, src.c_str(),
+	                               -1, NULL, 0);
+	if ( wlen == 0 ) {
+		ERR_FS << "Error converting \"" << src << "\" to wide characters ("
+		       << (a2u ? "ANSI" : "UTF-8") << ").\n";
+		return src;
+	}
+
+	// Convert the source to WCHAR.
+	boost::scoped_array<WCHAR> wc = new WCHAR[wlen];
+	if ( 0 == MultiByteToWideChar(a2u ? CP_ACP : CP_UTF8, 0, src.c_str(),
+	                              -1, wc.get(), wlen) ) {
+		ERR_FS << "Error storing \"" << src << "\" as "
+		       << (a2u ? "ANSI" : "UTF-8") << " wide characters.\n";
+		return src;
+	}
+
+	// Get the length of the destination in multibyte characters.
+	int mblen = WideCharToMultiByte(a2u ? CP_UTF8 : CP_ACP, 0, wc.get(),
+	                                wlen, NULL, 0, NULL, NULL);
+	if ( mblen == 0 ) {
+		// Cannot convert.
+		ERR_FS << "Error converting \"" << src << "\" to multibyte ("
+		       << (a2u ? "UTF-8" : "ANSI") << ").\n";
+		return src;
+	}
+
+	// Convert the WCHAR data to CHAR.
+	boost::scoped_array<CHAR> mb = new CHAR[mblen];
+	if ( 0 == WideCharToMultiByte(a2u ? CP_UTF8 : CP_ACP, 0, wc.get(),
+	                              wlen, mb.get(), mblen, NULL, NULL) ) {
+		ERR_FS << "Error storing \"" << src << "\" as "
+		       << (a2u ? "UTF-8" : "ANSI") << " multi-byte characters.\n";
+		return src;
+	}
+
+	// Handle front & back slashes.
+	if ( a2u ) {
+		for ( CHAR * p = mb.get(); *p != '\0'; ++p )
+			if ( *p == '\\' )
+				*p = '/';
+	}
+
+	// All that is left is turning this into a std::string.
+	return std::string(mb.get());
+}
+#endif
Index: src/savegame.cpp
===================================================================
--- src/savegame.cpp	(revision 56042)
+++ src/savegame.cpp	(working copy)
@@ -53,88 +53,15 @@
 static lg::log_domain log_enginerefac("enginerefac");
 #define LOG_RG LOG_STREAM(info, log_enginerefac)
 
-#ifdef _WIN32
-	#ifdef INADDR_ANY
-		#undef INADDR_ANY
-	#endif
-	#ifdef INADDR_BROADCAST
-		#undef INADDR_BROADCAST
-	#endif
-	#ifdef INADDR_NONE
-		#undef INADDR_NONE
-	#endif
 
-	#include <windows.h>
+inline void replace_underbar2space(std::string &name) {
+	std::replace(name.begin(),name.end(),'_',' ');
+}
+inline void replace_space2underbar(std::string &name) {
+	std::replace(name.begin(),name.end(),' ','_');
+}
 
-	/**
-	 * conv_ansi_utf8()
-	 *   - Convert a string between ANSI encoding (for Windows filename) and UTF-8
-	 *  string &name
-	 *     - filename to be converted
-	 *  bool a2u
-	 *     - if true, convert the string from ANSI to UTF-8.
-	 *     - if false, reverse. (convert it from UTF-8 to ANSI)
-	 */
-	void conv_ansi_utf8(std::string &name, bool a2u) {
-		int wlen = MultiByteToWideChar(a2u ? CP_ACP : CP_UTF8, 0,
-									   name.c_str(), -1, NULL, 0);
-		if (wlen == 0) return;
-		WCHAR *wc = new WCHAR[wlen];
-		if (wc == NULL) return;
-		if (MultiByteToWideChar(a2u ? CP_ACP : CP_UTF8, 0, name.c_str(), -1,
-								wc, wlen) == 0) {
-			delete [] wc;
-			return;
-		}
-		int alen = WideCharToMultiByte(!a2u ? CP_ACP : CP_UTF8, 0, wc, wlen,
-									   NULL, 0, NULL, NULL);
-		if (alen == 0) {
-			delete [] wc;
-			return;
-		}
-		CHAR *ac = new CHAR[alen];
-		if (ac == NULL) {
-			delete [] wc;
-			return;
-		}
-		WideCharToMultiByte(!a2u ? CP_ACP : CP_UTF8, 0, wc, wlen,
-							ac, alen, NULL, NULL);
-		delete [] wc;
-		if (ac == NULL) {
-			return;
-		}
-		name = ac;
-		delete [] ac;
 
-		return;
-	}
-
-	void replace_underbar2space(std::string &name) {
-		LOG_SAVE << "conv(A2U)-from:[" << name << "]" << std::endl;
-		conv_ansi_utf8(name, true);
-		LOG_SAVE << "conv(A2U)-to:[" << name << "]" << std::endl;
-		LOG_SAVE << "replace_underbar2space-from:[" << name << "]" << std::endl;
-		std::replace(name.begin(), name.end(), '_', ' ');
-		LOG_SAVE << "replace_underbar2space-to:[" << name << "]" << std::endl;
-	}
-
-	void replace_space2underbar(std::string &name) {
-		LOG_SAVE << "conv(U2A)-from:[" << name << "]" << std::endl;
-		conv_ansi_utf8(name, false);
-		LOG_SAVE << "conv(U2A)-to:[" << name << "]" << std::endl;
-		LOG_SAVE << "replace_space2underbar-from:[" << name << "]" << std::endl;
-		std::replace(name.begin(), name.end(), ' ', '_');
-		LOG_SAVE << "replace_space2underbar-to:[" << name << "]" << std::endl;
-	}
-#else /* ! _WIN32 */
-	void replace_underbar2space(std::string &name) {
-		std::replace(name.begin(),name.end(),'_',' ');
-	}
-	void replace_space2underbar(std::string &name) {
-		std::replace(name.begin(),name.end(),' ','_');
-	}
-#endif /* _WIN32 */
-
 namespace savegame {
 
 class save_index_class
@@ -487,8 +414,8 @@
 	std::string modified_name = name;
 	replace_space2underbar(modified_name);
 
-	remove((get_saves_dir() + "/" + name).c_str());
-	remove((get_saves_dir() + "/" + modified_name).c_str());
+	remove(system_filename(get_saves_dir() + "/" + name));
+	remove(system_filename(get_saves_dir() + "/" + modified_name));
 
 	save_index_manager.remove(name);
 }
Index: src/image.cpp
===================================================================
--- src/image.cpp	(revision 56042)
+++ src/image.cpp	(working copy)
@@ -439,7 +439,7 @@
 // Load overlay image and compose it with the original surface.
 static void add_localized_overlay (const std::string& ovr_file, surface &orig_surf)
 {
-	surface ovr_surf = IMG_Load(ovr_file.c_str());
+	surface ovr_surf = IMG_Load(system_filename(ovr_file));
 	if (ovr_surf.null()) {
 		return;
 	}
@@ -465,7 +465,7 @@
 			if (!loc_location.empty()) {
 				location = loc_location;
 			}
-			res = IMG_Load(location.c_str());
+			res = IMG_Load(system_filename(location));
 			// If there was no standalone localized image, check if there is an overlay.
 			if (!res.null() && loc_location.empty()) {
 				const std::string ovr_location = get_localized_path(location, "--overlay");
Index: src/preferences.cpp
===================================================================
--- src/preferences.cpp	(revision 56042)
+++ src/preferences.cpp	(working copy)
@@ -84,7 +84,7 @@
 {
     #ifndef _WIN32
 
-    bool prefs_file_existed = access(get_prefs_file().c_str(), F_OK) == 0;
+    bool prefs_file_existed = access(system_filename(get_prefs_file()), F_OK) == 0;
 
     #endif
 
@@ -100,7 +100,7 @@
 
     if(!prefs_file_existed) {
 
-        if(chmod(get_prefs_file().c_str(), 0600) == -1) {
+        if ( chmod(system_filename(get_prefs_file()), 0600) == -1 ) {
 			ERR_FS << "error setting permissions of preferences file '" << get_prefs_file() << "'\n";
         }
 
Index: src/gui/widgets/debug.cpp
===================================================================
--- src/gui/widgets/debug.cpp	(revision 56042)
+++ src/gui/widgets/debug.cpp	(working copy)
@@ -20,6 +20,7 @@
 
 #include "gui/widgets/debug.hpp"
 
+#include "filesystem.hpp"
 #include "formatter.hpp"
 #include "gui/widgets/generator.hpp"
 #ifdef GUI2_EXPERIMENTAL_LISTBOX
@@ -181,7 +182,7 @@
 			+ lexical_cast<std::string>(++sequence_number_)
 			+ "-" + generator + ".dot";
 
-	std::ofstream file(filename.c_str());
+	std::ofstream file(system_filename(filename));
 
 	file << "//Basic layout graph for window id '" << window_->id()
 		<< "' using definition '" <<  window_->definition_ << "'.\n"
Index: src/game_controller.cpp
===================================================================
--- src/game_controller.cpp	(revision 56042)
+++ src/game_controller.cpp	(working copy)
@@ -20,6 +20,7 @@
 #include "ai/configuration.hpp"
 #include "builder.hpp"
 #include "construct_dialog.hpp"
+#include "filesystem.hpp"
 #include "gettext.hpp"
 #include "gui/dialogs/addon_connect.hpp"
 #include "gui/dialogs/campaign_difficulty.hpp"
@@ -975,7 +976,7 @@
 	std::string command = "cmd /C start \"wesnoth server\" /B \"" + wesnothd_program + "\" -c \"" + config + "\" -t 2 -T 5";
 #endif
 	LOG_GENERAL << "Starting wesnothd: "<< command << "\n";
-	if (std::system(command.c_str()) == 0) {
+	if ( std::system(system_filename(command)) == 0 ) {
 		// Give server a moment to start up
 		SDL_Delay(50);
 		return;
