File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes unwanted chars Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "unwanted chars" Watch "unwanted chars" New topic

unwanted chars

feroz muhamed
Ranch Hand

Joined: Nov 15, 2003
Posts: 87
hi when i am writing data(input via keyboard using readLine method) to file using FileWriter,some unknowncharacters like 000 etc were seen what is this how can i avoid it? please help thanx in advnc
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
Are you writing text file? If you are, use FileWriter.
Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
having the same problem while using FileWriter. When opening the file with notepad there are squares added into the file, but with (for example) wordpad they are gone.
Anyone have any idea where they come from? The text is taken from a JTextArea. The display there is also OK.
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
I notice the same thing when opening some .java files, depending on how the files were created (for example, in JBuilder or some other IDE).
I think it comes from Notepad being a very simple text editor. Wordpad is slightly "smarter", so it knows how to handle special characters and formatting better.
I agree. Here's the link:
subject: unwanted chars
It's not a secret anymore!