Advertisement

06.03.2008 at 10:50PM PDT, ID: 23455674 | Points: 500
[x]
Attachment Details

UTF8 problem readind content of a web page

Asked by oleber in Java Programming Language, New to Java Programming, Java Standard Edition

I'm getting some char with 65533 in the strings when I run this code.

In the browser everything seems to run ok, since I see the correct webpage.

Thanks for the help
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
import java.io.BufferedReader;
 
public class Test {
	public static void main(String[] args) throws Exception {
		URI uri = new URI("http://jn.sapo.pt/paginainicial/ultimas/default.aspx");
		BufferedReader reader = new BufferedReader(new InputStreamReader(uri.toURL().openStream(), "UTF8"));
		
		String str;
		while ((str = reader.readLine()) != null) {
			System.out.println(str);
		}
	}
}
[+][-]06.03.2008 at 11:10PM PDT, ID: 21707315

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 11:44PM PDT, ID: 21707463

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.04.2008 at 12:45AM PDT, ID: 21707735

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.04.2008 at 12:53AM PDT, ID: 21707776

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.04.2008 at 01:15AM PDT, ID: 21707882

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.28.2008 at 12:29PM PDT, ID: 22338815

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628