Use prefered locale for conversions from/to current locale

This commit is contained in:
victorlevasseur
2015-05-14 14:03:50 +02:00
parent 3b1e7d4d49
commit 0c32f98804

View File

@@ -9,6 +9,7 @@
#include <exception>
#include <iostream>
#include <locale>
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
#include <wx/string.h>
@@ -22,20 +23,12 @@ namespace utf8
std::string GD_CORE_API FromLocaleString( const std::string &str )
{
#if defined(WINDOWS)
return FromSfString(sf::String(str));
#else
return str; //UTF8 is already the current locale on Linux
#endif
return FromSfString(sf::String(str, std::locale("")));
}
std::string GD_CORE_API ToLocaleString( const std::string &utf8str )
{
#if defined(WINDOWS)
return ToSfString(utf8str).toAnsiString();
#else
return utf8str; //UTF8 is already the current locale on Linux
#endif
return ToSfString(utf8str).toAnsiString(std::locale(""));
}
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)