mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 11:33:44 +01:00
Use narrow_to_wide in gettext instead of os dependent conversion fct
This commit is contained in:
parent
ea0df3e4cb
commit
a230e1e736
@ -48,6 +48,10 @@ void init_gettext(const char *path,std::string configured_language,int argc, cha
|
|||||||
void init_gettext(const char *path,std::string configured_language);
|
void init_gettext(const char *path,std::string configured_language);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern std::wstring narrow_to_wide(const std::string& mbs);
|
||||||
|
#include "util/numeric.h"
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
inline wchar_t* chartowchar_t(const char *str)
|
inline wchar_t* chartowchar_t(const char *str)
|
||||||
{
|
{
|
||||||
@ -66,7 +70,10 @@ inline wchar_t* chartowchar_t(const char *str)
|
|||||||
#else
|
#else
|
||||||
size_t l = strlen(str)+1;
|
size_t l = strlen(str)+1;
|
||||||
nstr = new wchar_t[l];
|
nstr = new wchar_t[l];
|
||||||
mbstowcs(nstr, str, l);
|
|
||||||
|
std::wstring intermediate = narrow_to_wide(str);
|
||||||
|
memset(nstr,0,l);
|
||||||
|
memcpy(nstr,intermediate.c_str(),l*sizeof(wchar_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return nstr;
|
return nstr;
|
||||||
|
Loading…
Reference in New Issue
Block a user