mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Use prefered locale for conversions from/to current locale
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user