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!

Problem using PrintStream to write to file.

807588Apr 7 2009 — edited Apr 9 2009
I am trying to write some String data to a file.

I have replaced System.out with a PrintStream of my own.

When I open the file with notepad,

there are little squared at the end of each line with text written.

I'm guessing they have something to do with

the default character encoding on a PrintStream Object.

I am aware that

"All characters printed by a PrintStream are converted into bytes using the platform's default character encoding".

as I am aware of the "java.nio.charset.Charset "

class. I have tryed specifying UTF-8 and US-ASII

encoding when instantiating a PrintStream Object.

What can I do to prevent the square being written, and just using default new lines

there, no matter how the file is viewed?

(my OS is Windows XP service pack 2)

:)

?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2009
Added on Apr 7 2009
10 comments
356 views