🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.lang.java
Article #19152

Re: �����������ֽ����еĺ�����Ϣ

#19152
From: ��ţ
Date: Fri, 09 Jan 2004 12:03
51 lines
3274 bytes
лл
������ƣ�������û�г��׽����
�Ұ�����ķ����޸�֮�󣬳����á�UTF-8"����ģ�����������
UTF��8���ֽ����������û�����⣬������ϵͳ���ֱ�����GBK�����
���ֲ��ִ��֣�
private static String readFromSocket(InputStream in) throws IOException {
            StringBuffer str = new StringBuffer(131072);
//  String str=new String();


            int c=in.read();
            str.append((char) c);
            while (c!=10) {
                    c=in.read();
//final int HZHi0 = 0xB0;                         // ���ָ�λ��С
//final int HZLo0 = 0xA1;                         // ���ֵ�λ��С
//final int HZHi1 = 0xF7;                         // ���ָ�λ���
//final int HZLo1 = 0xFE;                         // ���ֵ�λ���
                    int hi = c & 0x000000ff;
                    int lo = c & 0x000000ff;
                    if (c!=10&&!((hi >= 0xB0) && (hi <= 0xF7))&&
                        !((lo >= 0xA1) && (lo <= 0xFE))){
                      str.append((char) c);
                    }
                    if((hi >= 0xB0) && (hi <= 0xF7))
                    {
                      byte d[]={1,0};
                      d[0]=(byte)hi;
                      d[1]=(byte)in.read();
                      String str1=new String(d);
                      str.append(str1);
                    }
            }
            String result=str.toString();
            if (logClient) System.out.println(result);
            return result;
    }

�� �� javaphp. �Ĵ������ᵽ: ��
: InputSreamReader�࿴һ��


--
���� �� ��������������
�����������������}�~��
������{�z������������
 �������� ��������������   ������������...������..
������������������������   ������ �߰ѿ��˸����� >"<
��  ��    ��������������������

�� ��Դ:��Ʈ��ˮ�Ƽ� freecity.cnzju.net��[FROM: nw]
Technical Details
Message-ID: <4AC9aB$A0M@freecity.cnzju.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!news-in-sterling.newsfeed.com!ngpeer.news.aol.com!feed2.newsreader.com!newsreader.com!maily.cic.tsinghua.edu.cn!news.ccie.net.cn!Freecity

Show Full Headers
Complete Article Headers
X-Google-Language: Chinese,GB
X-Google-Thread: f6cb0,d03f2c84395bcb48
X-Google-Attributes: gidf6cb0,public
X-Google-ArrivalTime: 2004-01-09 04:06:39 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!news-in-sterling.newsfeed.com!ngpeer.news.aol.com!feed2.newsreader.com!newsreader.com!maily.cic.tsinghua.edu.cn!news.ccie.net.cn!Freecity
From: nw.bbs@freecity.cnzju.net (��ţ)
Newsgroups: cn.bbs.comp.lang.java
Subject: Re: �����������ֽ����еĺ�����Ϣ
Date: 09 Jan 2004 12:03:16 GMT
Organization: Ʈ��ˮ�Ƽ�
Message-ID: <4AC9aB$A0M@freecity.cnzju.net>
Mime-Version: 1.0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 8bit
X-Filename: Java/M.1073649611.A