Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #25970

Re: Reading a text file

From bruce <bruceaj@bellsouth.net>
Newsgroups comp.lang.java.programmer
Subject Re: Reading a text file
Date 2011-02-11 20:57 -0800
Organization http://groups.google.com
Message-ID <7e8027f8-7ee4-48bc-bfc1-341f6581d326@a28g2000vbo.googlegroups.com> (permalink)
References <19a4db14-7d28-465f-9f49-bdcee93a0ac7@s3g2000vbf.googlegroups.com> <64e6f4db-a931-400a-87d4-16da79e8af17@z31g2000vbs.googlegroups.com>

Show all headers | View raw


On Feb 11, 11:46 pm, bruce <bruc...@bellsouth.net> wrote:
> On Feb 11, 9:26 pm, bruce <bruc...@bellsouth.net> wrote:
>
>
>
> > I am reading a file with
>
> >     BufferedReader reader = null;
> >     StringBuffer contents = new StringBuffer();
> >     while ((text = reader.readLine()) != null) {
> >                 contents.append(text)
> >                     .append(System.getProperty(
> >                         "line.separator"));
> >                 }
>
> > This code reads the file fine.  My problem is that when I put the data
> > into a text, it is displayed with a space character before ever
> > character. (bruce => b r u c e)
>
> > What am I doing wrong??
>
> > Thanks...
>
> > Bruce
>
> I have just learned something. I don't know what it is but it appears
> that not all files give this space problem. I have loaded several
> other .txt files with no problem. So, I have some more testing to do
> before I can define the problem.
>
> Thanks..
>
> Bruce

Okay.. I still don't know how the problem appeared. But, I loaded the
problem file into Notepad+, set the Encoding to UTF-8. The problem is
gone. So, somehow the problem file was saved with Encoding set to
something that gave the spacing problem.

Problem identified.

Thanks for all the help..

Bruce

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar


Thread

Re: Reading a text file bruce <bruceaj@bellsouth.net> - 2011-02-11 20:57 -0800
  Re: Reading a text file Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-02-12 00:00 -0500

csiph-web