I've read many threads but really so far none of them helped. I am trying to download and parse JSON which contains some UTF8 characters. Everything works fine except for encoding of those syntaxes. Could you please help me?
HttpGet request = new HttpGet(uri);
HttpResponse resp = client.execute(request);
entity = resp.getEntity();
fos = context.openFileOutput(fileSavePath, Context.MODE_PRIVATE); //fos is FileOutputStream
entity.writeTo(fos);
entity.consumeContent();
fos.flush();
fos.close();
and then I open the file like this:
stream = context.openFileInput(AppConfig.CATEGORIES_JSON_PATH);
reader = new InputStreamReader(stream, StringUtils.UTF8);
I believe that gson stuff is correct and only opening and saving the file matter. I also believe that the mistake lies in entity.writeTo(fos);, cause none encoding is specified. So i tried writingwith byte buffer and OutputStreamWriter, but then gson threw MalformedJsonException: Untermineted string...
any help is highly appreciated