Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Encoding problem with inputStream

807569Jul 26 2006 — edited Jul 26 2006
Hello,

i have a problem by get content from a file (HTML Code). The code looks like this:
BufferedInputStream is = new BufferedInputStream ( new FileInputStream (name) );
Later the InputStream is will read and stored in a ByteArrayOutputStream bytearrayoutputstream. Code for this looks like this:
byte abyte0[] = new byte;
int j = inputstream.read(abyte0);
bytearrayoutputstream.write(abyte0, 0, j);

When i debug (with tomcat and eclipse) my application (portal) and look in the variable [i]is
i see only the values 0. When i look in the bytearrayoutputstream after the variable is is stored in i can see the content of the file (the HTML code which is readed). The HTML code comprised some cyrillic characters. This cyrillic characters are not correct displayed in the variable bytearrayoutputstream. The cause of this is, in my opinion, that i can not specify the encoding which should be UTF-8. WHAT can i do that i get an byteArrayOutputStream with the correct display cyrillic characters (with the right encoding UTF-8) ?? Thank you for your help. Greets Oliver
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 23 2006
Added on Jul 26 2006
9 comments
572 views