0
I am consuming data from a webservice that returns a list with JSON objects, this way:
[{"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 by the browser they come all accented correctly in the response to the request. But when I request on Android the answer in JSON brings the accented characters replaced by queries, so that trying to convert to UTF-8 or ISO-8859-1 in java also did not work. Stay that way:
[{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’m 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 any external or own retrofit lib solution I can use to solve?