글쓴이 :박경수 2000년 5월 25일 16:44:16
아래와 같이 코딩했는데 한글이 깨져서 나옵니다.
어찌 소스를 고치면 한글이 깨지지 않을까요.
import java.net.*;
import java.io.*;
public class URLRead
{
public static void main(String args[]) throws Exception
{
try
{
if (args.length != 1)
{
System.err.println ("Invalid command parameters");
System.in.read();
System.exit(0);
}
URL url = new URL(args[0]);
InputStream in = url.openStream();
BufferedInputStream bufIn = new BufferedInputStream(in);
for (;;)
{
int data = bufIn.read();
if (data == -1)
break;
else
System.out.print((char)data);
}
}
catch (MalformedURLException mue)
{
System.err.println ("Invalid URL");
}
catch (IOException ioe)
{
System.err.println ("I/O Error - " + ioe);
}
}
}