Skip to content

Commit 60f31ad

Browse files
committedJun 14, 2015
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.
1 parent b6387b4 commit 60f31ad

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎src/util/string.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ std::wstring utf8_to_wide(const std::string &input)
8383
return out;
8484
}
8585

86+
#ifdef __ANDROID__
87+
// TODO: this is an ugly fix for wide_to_utf8 somehow not working on android
88+
std::string wide_to_utf8(const std::wstring &input)
89+
{
90+
return wide_to_narrow(input);
91+
}
92+
#else
8693
std::string wide_to_utf8(const std::wstring &input)
8794
{
8895
size_t inbuf_size = (input.length() + 1) * sizeof(wchar_t);
@@ -102,6 +109,7 @@ std::string wide_to_utf8(const std::wstring &input)
102109

103110
return out;
104111
}
112+
#endif
105113
#else
106114
std::wstring utf8_to_wide(const std::string &input)
107115
{
@@ -126,7 +134,6 @@ std::string wide_to_utf8(const std::wstring &input)
126134
}
127135
#endif
128136

129-
130137
// You must free the returned string!
131138
// The returned string is allocated using new
132139
wchar_t *narrow_to_wide_c(const char *str)

0 commit comments

Comments
 (0)
Please sign in to comment.