mirror of
https://github.com/moparisthebest/minetest
synced 2024-11-17 14:55:13 -05:00
Android: bypass broken wide_to_utf8 with wide_to_narrow
While utf8_to_wide works well, wide_to_utf8 is quite broken on android, for some reason.
This commit is contained in:
parent
b6387b4e0f
commit
60f31ad523
@ -83,6 +83,13 @@ std::wstring utf8_to_wide(const std::string &input)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
// TODO: this is an ugly fix for wide_to_utf8 somehow not working on android
|
||||||
|
std::string wide_to_utf8(const std::wstring &input)
|
||||||
|
{
|
||||||
|
return wide_to_narrow(input);
|
||||||
|
}
|
||||||
|
#else
|
||||||
std::string wide_to_utf8(const std::wstring &input)
|
std::string wide_to_utf8(const std::wstring &input)
|
||||||
{
|
{
|
||||||
size_t inbuf_size = (input.length() + 1) * sizeof(wchar_t);
|
size_t inbuf_size = (input.length() + 1) * sizeof(wchar_t);
|
||||||
@ -102,6 +109,7 @@ std::string wide_to_utf8(const std::wstring &input)
|
|||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
std::wstring utf8_to_wide(const std::string &input)
|
std::wstring utf8_to_wide(const std::string &input)
|
||||||
{
|
{
|
||||||
@ -126,7 +134,6 @@ std::string wide_to_utf8(const std::wstring &input)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// You must free the returned string!
|
// You must free the returned string!
|
||||||
// The returned string is allocated using new
|
// The returned string is allocated using new
|
||||||
wchar_t *narrow_to_wide_c(const char *str)
|
wchar_t *narrow_to_wide_c(const char *str)
|
||||||
|
Loading…
Reference in New Issue
Block a user