I want to download this UTF-8 file and convert it to Latin1 in Java (Android). At line 443, Frango-dâ~@~Yágua-menor
is translated to Frango-d?água-menor
instead of Frango-d'água-menor
. Same in line 465, where Descrição fÃsicaâ~@¦
is translated to Descrição física?
, with that pesky ?
at the end.
It seems this file is not a valid UTF-8
? But iconv -f utf-8 -t iso-8859-1//TRANSLIT
on this file works just fine.
This is the code I use to download (downloaded file is in infofile
):
fos = new FileOutputStream(infotxt);
out = new OutputStreamWriter(fos, 'Latin1');
fis = new FileInputStream(infofile);
br = new BufferedReader(new InputStreamReader(fis));
while ((line = br.readLine()) != null) {
out.write("\n"+line.trim());
}
br.close();
out.close();
fis.close();
fos.close();