I want to read an xml file from the internet. You can find it here.
The problem is that it is encoded in UTF-8 and I need to store it into a file in order to parse it later. I have already read a lot of topics about that and here is what I came up with :
BufferedReader in;
String readLine;
try
{
in = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
BufferedWriter out = new BufferedWriter(new FileWriter(file));
while ((readLine = in.readLine()) != null)
out.write(readLine+"\n");
out.close();
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
This code works until this line : <title>Chérie FM</title>
When I debug, I get this : <title>Ch�rie FM</title>
Obviously, there is something I fail to understand, but it seems to me that I followed the code saw on several website.