🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #16038

Read Chinese file???

#16038
From: Joseph Lin
Date: Fri, 09 Apr 1999 00:00
29 lines
1385 bytes
I want to read a Chinese file on the server and display the file
contents on the local, I write the following code:

        URL url = null;
        String data = null;
        
        try
        {
            url = new URL("http://aaa.bbb.ccc/~joseph/Q.TXT");
        }
        catch(MalformedURLException e)
        { ; }
        try
        {
            DataInputStream in = new DataInputStream(url.openStream());
            byte[] bytes = new byte[128];
            in.read(bytes, 0, 128);
            data = new String(bytes, "Big5");
            System.out.println(data);
        }
        catch(IOException e)
        { ; }

But the output is not what I want.
Does anybody know how to make it work right?

-- 
�ͩR���L�{�n����A��n���H
�ߤ�������ᦷ�A����H�Ҿ�
Technical Details
Message-ID: <370D0E07.E429FBDA@mail3.intellect.com.tw>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f74b3,de1a0714a7012f13,start
X-Google-Attributes: gidf74b3,public
From: Joseph Lin <naussica@mail3.intellect.com.tw>
Subject: Read Chinese file???
Date: 1999/04/09
Message-ID: <370D0E07.E429FBDA@mail3.intellect.com.tw>
X-Deja-AN: 464162960
Content-Transfer-Encoding: 8bit
X-Accept-Language: en
Content-Type: text/plain; charset=iso-8859-1
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language