diff options
author | sapier <Sapier at GMX dot net> | 2014-04-06 10:39:32 +0200 |
---|---|---|
committer | sapier <Sapier at GMX dot net> | 2014-04-19 11:33:57 +0200 |
commit | a230e1e7360eb561429bf69ad8793745fbd5e7c3 (patch) | |
tree | c0554809754d47ea1b8a9a110dde68e2aebf6488 | |
parent | ea0df3e4cb75a7a104a81e050c019049219c4fee (diff) | |
download | minetest-a230e1e7360eb561429bf69ad8793745fbd5e7c3.tar.gz minetest-a230e1e7360eb561429bf69ad8793745fbd5e7c3.tar.bz2 minetest-a230e1e7360eb561429bf69ad8793745fbd5e7c3.zip |
Use narrow_to_wide in gettext instead of os dependent conversion fct
-rw-r--r-- | src/gettext.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gettext.h b/src/gettext.h index 02aa6979d..3299f5b25 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -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); #endif +extern std::wstring narrow_to_wide(const std::string& mbs); +#include "util/numeric.h" + + /******************************************************************************/ inline wchar_t* chartowchar_t(const char *str) { @@ -66,7 +70,10 @@ inline wchar_t* chartowchar_t(const char *str) #else size_t l = strlen(str)+1; 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 return nstr; |