toUNICODE

Hi, I'm trying to convert mail message content (using javamail) to UNICODE. The bytes printed here are not UNICODE. What is wrong?

InputStream is=msg.getInputStream();

ByteArrayOutputStream baos=new ByteArrayOutputStream();

int b;

while ((b=is.read())!=-1){

baos.write(b);

}

baos.flush();

OutputStreamWriter osw=new OutputStreamWriter(baos,"UNICODE");

byte[] bb=baos.toByteArray();

for (int i=0;i<bb.length;i++){

System.out.println(bb[i]);

}

Naor>

[906 byte] By [naor_ya] at [2007-10-2 5:16:36]
# 1
Crossposted: http://forum.java.sun.com/thread.jspa?threadID=682997&messageID=3978897#3978897
mvantuyla at 2007-7-16 1:18:55 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
this subject relate to several topics. I put it in one forum and no one knew so I asked in other places.Please help
naor_ya at 2007-7-16 1:18:55 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
this topic lies here for a lot of days without answer!suddenly everybody awake and can write me how wrong to do so.Instead of doing this, try to do something good and help.
naor_ya at 2007-7-16 1:18:55 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
Naor, I have basically given up answering your questions because it seems like a waste of time. However what is wrong here is that you think "UNICODE" is the name of a charset. It isn't.
DrClapa at 2007-7-16 1:18:55 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5

I respect your thoughts. I will keep my thoughts to myself.

according to what you write, what is UNICODE? and what is the charset of UNICODE?

look, there is something I don't know and I am trying to understand. If you really read my questions you saw that I am asking about the same thing. If you really want to help, it will be welcome. If not, ani other reply is unneccecery.

Thanks, Naor.

naor_ya at 2007-7-16 1:18:55 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 6
There is no character set "of UNICODE." Unicode is comprised of many character sets. See http://www.unicode.org.
KJKruma at 2007-7-16 1:18:55 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 7
Thanks for your answer.my goal is to convert the content to unicode format. I changed the "UNICODE" to "UTF-16" but it still doesn't work *I am chacking the result by looking on the bytes I get).How can I do it?Thanks, Naor.
naor_ya at 2007-7-16 1:18:55 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...