git-svn-id: svn://db.shs.com.ru/pip@555 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2017-11-20 14:32:19 +00:00
parent a1b95e6e66
commit 9f2c55de5b
4 changed files with 27 additions and 16 deletions

View File

@@ -20,8 +20,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
#include <string.h>
#include "piincludes_p.h"
#include "pibytearray.h"
#ifdef PIP_ICU
# include "unicode/ucnv.h"
@@ -115,9 +114,13 @@ PIChar PIChar::fromUTF8(const char * c) {
#endif
//#ifdef ANDROID
wchar_t wc(0);
mbstate_t s;
mbrtowc(&wc, c, 4, &s);
ret.ch = wc;
mbtowc(0, 0, 0); // reset mbtowc
//mbstate_t s;
//mbrtowc(&wc, c, 4, &s);
int sz = 0;
sz = mbtowc(&wc, c, sizeof(ushort));
if (sz < 1 || sz > (int)sizeof(ushort)) ret.ch = 0;
else ret.ch = wc;
return ret;
//#endif
// ret.ch = *(ushort*)c;