diff options
author | est31 <MTest31@outlook.com> | 2015-06-14 06:38:02 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-06-14 08:25:21 +0200 |
commit | 60f31ad52348c53209701d0112f9f809018f7188 (patch) | |
tree | e88865083f34ed024e47f8605d3651fe86de7b73 /src/util | |
parent | b6387b4e0f43503ae139cb31a04f42c401378fdc (diff) | |
download | minetest-60f31ad52348c53209701d0112f9f809018f7188.tar.gz minetest-60f31ad52348c53209701d0112f9f809018f7188.tar.bz2 minetest-60f31ad52348c53209701d0112f9f809018f7188.zip |
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.
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/string.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/util/string.cpp b/src/util/string.cpp index 49aff4a1f..0a7ab5c3a 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -83,6 +83,13 @@ std::wstring utf8_to_wide(const std::string &input) 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) { 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; } +#endif #else std::wstring utf8_to_wide(const std::string &input) { @@ -126,7 +134,6 @@ std::string wide_to_utf8(const std::wstring &input) } #endif - // You must free the returned string! // The returned string is allocated using new wchar_t *narrow_to_wide_c(const char *str) |