Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About language support

Status
Not open for further replies.

volcano

Programmer
Aug 29, 2000
136
HK
Hi ladies and gentlemen. I have a question that I hope you would do me a favour. Thanks!

I wrote a Java program which will get the content (or source code) of HTML pages. The content often contains Chinese. When I use Java 1.2.2 to compile and run the program, the Chinese can be displayed correctly. But If I compile and run by Java SDK 1.4.1, the Chinese will become question marks. Do you have any solution or advice to this problem? The source code of the program is shown below for reference:
-------------------------------------

import java.io.*;
import java.net.*;

public class TEST
{
public static void main (String args[]) throws Exception
{

URL url = new URL(" HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
InputStream in = conn.getInputStream();

String line, s;
while (in.available() > 0)
{
byte[] b = new byte[1000];
in.read(b);
s = new String(b);
System.out.println(s);
}
in.close();
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top