Skip to content

Commit

Permalink
Android: bypass broken wide_to_utf8 with wide_to_narrow
Browse files Browse the repository at this point in the history
While utf8_to_wide works well, wide_to_utf8 is quite broken
on android, for some reason.
  • Loading branch information
est31 committed Jun 14, 2015
1 parent b6387b4 commit 60f31ad
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/util/string.cpp
Expand Up @@ -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);
Expand All @@ -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)
{
Expand All @@ -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)
Expand Down

0 comments on commit 60f31ad

Please sign in to comment.