🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Unicode Conversion - Help

#8224
From: John McGrath TeamB
Date: Sat, 14 Apr 2001 00:52
30 lines
2248 bytes
On Fri, 13 Apr 2001 12:23:34 -0700, Harry Whitehouse wrote:

> InputStreamReader MyInputStream
>    = new InputStreamReader(uc.getInputStream());

I think this is where your problem lies.

An InputStream handles a sequence of bytes, whereas a Reader handles 
a sequence of Unicode characters.  When you use an InputStreamReader, 
it takes the bytes from the InputStream and converts them to Unicode 
characters based on the encoding set for the InputStream.  This can 
be set in the second argument to the InputStreamReader constructor, 
and if you do not specify this, it uses the default encoding for the 
platform you are running on, which is probably UTF-8.

If the encoding if the stream is one of the standard encodings known 
to your JVM, you could just specify the appropriate encoding to the 
InputStreamReader constructor, and it will handle the conversion for 
you.  If not, you could either read the bytes from the InputStream, 
or you could try defining your own converter class.  But I am not 
sure exactly what is involved in installing your own converter.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.154159e6664fc4d098a124@forums.borland.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out-sjo.usenetserver.com!feed2.onemain.com!feed1.onemain.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3ad4f06c$2_2@dnews> <MPG.154086682953719398a11d@forums.borland.com> <3ad7522f$1_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,eba31f969c5fae3c
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-04-13 18:14:02 PST
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Unicode Conversion - Help
Date: Fri, 13 Apr 2001 20:52:32 -0400
Message-ID: <MPG.154159e6664fc4d098a124@forums.borland.com>
References: <3ad4f06c$2_2@dnews> <MPG.154086682953719398a11d@forums.borland.com> <3ad7522f$1_1@dnews>
X-Newsreader: MicroPlanet Gravity v2.30
NNTP-Posting-Host: 209.92.40.60
X-Trace: dnews 987209538 209.92.40.60 (13 Apr 2001 17:52:18 -0700)
Lines: 30
X-Authenticated-User: jpmcgrath
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out-sjo.usenetserver.com!feed2.onemain.com!feed1.onemain.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews