I'm consuming data from a webservice that returns a list with JSON objects, like this:
[{"idPDV":3062,"nomeFantasia":"SEBASTIÃO JOSÉ DOS SANTOS","endereco":"RUA MANCHE CATAN DAVID, 130","bairro":"VIDA NOVA","CEP":"79017164","latitude":"-20.382218","longitude":"-54.569492"}]
Some of these guys have accentuation in the text and accessing the URL through the browser they are all accented correctly in the response of the request. But when I make the request on Android the response in JSON brings the accented characters replaced with questions, so trying to convert to UTF-8 or ISO-8859-1 in java did not work either. It looks like this:
[{idPDV=3062, nomeFantasia=SEBASTI�O JOS� DOS SANTOS, endereco=RUA MANCHE CATAN DAVID, 130, bairro=VIDA NOVA, CEP='79017164, latitude='-20.382218, longitude='-54.569492'}]
This is the code where I am retrieving the data:
retrofit = new Retrofit.Builder()
.baseUrl("http://minhaurl")
.addConverterFactory(GsonConverterFactory.create())
.build();
PdvsService service = retrofit.create(PdvsService.class);
Call<List<PontoDeVenda>> call = service.allPdvs();
call.enqueue(new Callback<List<PontoDeVenda>>() {
@Override
public void onResponse(Call<List<PontoDeVenda>> call, Response<List<PontoDeVenda>> response) {
for (PontoDeVenda pdv : response.body()) {
Log.d("PDV", pdv.toString());
}
PdvArrayAdapter arrayAdapter = new PdvArrayAdapter(getActivity().getApplicationContext(), R.layout.item_lista_pdv, response.body());
arrayAdapter.clear();
lstPdvs.setAdapter(arrayAdapter);
setOffLoading();
}
@Override
public void onFailure(Call<List<PontoDeVenda>> call, Throwable t) {
Log.e("Erro", t.getMessage());
}
});
Is there an external solution or the own lib retrofit that I can use to solve it?