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


Groups > comp.lang.java.programmer > #25602 > unrolled thread

Re: Reading a text file

Started byEric Sosman <esosman@ieee-dot-org.invalid>
First post2011-02-11 23:36 -0500
Last post2011-02-11 21:03 -0800
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Reading a text file Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-02-11 23:36 -0500
    Re: Reading a text file bruce <bruceaj@bellsouth.net> - 2011-02-11 21:03 -0800

#25602 — Re: Reading a text file

FromEric Sosman <esosman@ieee-dot-org.invalid>
Date2011-02-11 23:36 -0500
SubjectRe: Reading a text file
Message-ID<ij52v8$cm1$1@news.eternal-september.org>
On 2/11/2011 11:08 PM, bruce wrote:
> On Feb 11, 10:42 pm, Eric Sosman<esos...@ieee-dot-org.invalid>  wrote:
>> [...] Please provide code that is SHORT and
>> SELF-CONTAINED and COMPLETE and COMPILABLE.  [...]
>
> I am sorry but including all the code is hard to do. I am using
> NetBeans and it generates a lot of support code. [...]

     Fine -- But to demonstrate the problem, do you really need the
Logger stuff, or the Menu handling, or three-quarters of the rest
of the code?  No: All you need is the JFrame, the JTextArea, and
the read-file-and-insert code.  Well, all right, maybe the JScrollPane
too -- but much of what you provided was purely irrelevant to the
problem at hand.

     Still, I did what I could.  I compiled it under NetBeans (and
it compiled on the first try; thanks for the effort), and I ran it
(and it ran; ditto), and I fed it a handy text file -- and I don't
see the problem you describe.  The content of the text file shows
up in the text area, looking just like the content that shows up in
System.out (except for the font, of course).

     Since the problem isn't with the code ("It works fine for me"),
I suspect something's screwy with the input file you're choosing.
What's its provenance?  Did it come from some other system, maybe
a system that favors different character encodings or something?
Have you examined it in a hex editor to see if there are any strange
bytes interspersed with those you expect?  "When you have eliminated
the impossible, whatever remains, however improbable, must be the
truth" -- and I think we've shown that the code (although it could
use some improvement) is not the root of your problem.  Hence, we
must follow Mr. Holmes' dictum and look elsewhere.

-- 
Eric Sosman
esosman@ieee-dot-org.invalid

[toc] | [next] | [standalone]


#26117

Frombruce <bruceaj@bellsouth.net>
Date2011-02-11 21:03 -0800
Message-ID<f5bebb70-7d53-4e4b-b30d-5a8df3c5f3ce@x17g2000yqa.googlegroups.com>
In reply to#25602
On Feb 11, 11:36 pm, Eric Sosman <esos...@ieee-dot-org.invalid> wrote:
> On 2/11/2011 11:08 PM, bruce wrote:
>
> > On Feb 11, 10:42 pm, Eric Sosman<esos...@ieee-dot-org.invalid>  wrote:
> >> [...] Please provide code that is SHORT and
> >> SELF-CONTAINED and COMPLETE and COMPILABLE.  [...]
>
> > I am sorry but including all the code is hard to do. I am using
> > NetBeans and it generates a lot of support code. [...]
>
>      Fine -- But to demonstrate the problem, do you really need the
> Logger stuff, or the Menu handling, or three-quarters of the rest
> of the code?  No: All you need is the JFrame, the JTextArea, and
> the read-file-and-insert code.  Well, all right, maybe the JScrollPane
> too -- but much of what you provided was purely irrelevant to the
> problem at hand.
>
>      Still, I did what I could.  I compiled it under NetBeans (and
> it compiled on the first try; thanks for the effort), and I ran it
> (and it ran; ditto), and I fed it a handy text file -- and I don't
> see the problem you describe.  The content of the text file shows
> up in the text area, looking just like the content that shows up in
> System.out (except for the font, of course).
>
>      Since the problem isn't with the code ("It works fine for me"),
> I suspect something's screwy with the input file you're choosing.
> What's its provenance?  Did it come from some other system, maybe
> a system that favors different character encodings or something?
> Have you examined it in a hex editor to see if there are any strange
> bytes interspersed with those you expect?  "When you have eliminated
> the impossible, whatever remains, however improbable, must be the
> truth" -- and I think we've shown that the code (although it could
> use some improvement) is not the root of your problem.  Hence, we
> must follow Mr. Holmes' dictum and look elsewhere.
>
> --
> Eric Sosman
> esos...@ieee-dot-org.invalid

As you state, the problem was elsewhere, namely it was an encoding
problem. I've got a suspicion that it might have been an MS Word
document saved as a .txt file. I need to head for bed but I'll spend
ome time trying to identify the cause of the Encoding problem.

Thanks loads for helping...

Bruce

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web