Page 2 of 2 FirstFirst 12
Results 21 to 31 of 31
Like Tree1Likes

Thread: Scanner does not read to the end of a very long TXT file

  1. #21
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: Scanner does not read to the end of a very long TXT file

    You can't ask that question without specifying which characters they are of course.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  2. #22
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,538
    Blog Entries
    7
    Rep Power
    20

    Default Re: Scanner does not read to the end of a very long TXT file

    So my guess in reply #16 was correct; now all the OP has to do is figure out the used encoding ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #23
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,016
    Rep Power
    20

    Default Re: Scanner does not read to the end of a very long TXT file

    Quote Originally Posted by ImTroyMiller View Post
    Any idea on why these two character stumped the JVM?
    Print the IOException that (probably) caused the Scanner to stop?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #24
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,016
    Rep Power
    20

    Default Re: Scanner does not read to the end of a very long TXT file

    Quote Originally Posted by JosAH View Post
    So my guess in reply #16 was correct; now all the OP has to do is figure out the used encoding ...

    kind regards,

    Jos
    Smart arse...:)
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #25
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,538
    Blog Entries
    7
    Rep Power
    20

    Default Re: Scanner does not read to the end of a very long TXT file

    Quote Originally Posted by Tolls View Post
    Smart arse...:)
    C'est moi ...

    Jos ;-)
    cenosillicaphobia: the fear for an empty beer glass

  6. #26
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: Scanner does not read to the end of a very long TXT file

    Yeah even your ass is smart, you're some kind of super-human.

    ps: super-awkwardness was intended)
    Last edited by gimbal2; 07-08-2014 at 01:19 PM.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #27
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,538
    Blog Entries
    7
    Rep Power
    20

    Default Re: Scanner does not read to the end of a very long TXT file

    Quote Originally Posted by gimbal2 View Post
    Yeah even your ass is smart, you're some kind of super-human.
    Yep, but I don't do the thinking with that part; I use another body part for that ...

    kind regards,

    Jos (<--- clever dickie ;-)
    cenosillicaphobia: the fear for an empty beer glass

  8. #28
    ImTroyMiller is offline Member
    Join Date
    Jan 2014
    Posts
    20
    Rep Power
    0

    Default Re: Scanner does not read to the end of a very long TXT file

    Well, after changing the file and saving it, it worked fine. I put a little bit of time into search through other files to see if I could come across the specific characters, but they simply weren't there.

    I'm using NotePad+ to open and save this file. Could my selected encoding some how be adding things to the file, and then those characters possibly throw off my program?

  9. #29
    ImTroyMiller is offline Member
    Join Date
    Jan 2014
    Posts
    20
    Rep Power
    0

    Default Re: Scanner does not read to the end of a very long TXT file

    Trying to save just the character in a TXT file gives me...

    "This file contains characters in Unicode format which will be lost if you save this file as an ANSI encoded text file...."

    This is the first character...

    ҁ

  10. #30
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,538
    Blog Entries
    7
    Rep Power
    20

    Default Re: Scanner does not read to the end of a very long TXT file

    Quote Originally Posted by ImTroyMiller View Post
    Trying to save just the character in a TXT file gives me...

    "This file contains characters in Unicode format which will be lost if you save this file as an ANSI encoded text file...."

    This is the first character...

    ҁ
    That's a 'c-cedille', i.e. a 'c' with a small turd hanging from its bottom; it's a pronunciation mark (the 'c' is pronouned as a 'k' without the turd). It is not an ASCII character so you should save your file in an encoding that supports that character (UTF-8 will do) and you should open the file for reading in the same en/decoding scheme.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  11. #31
    ImTroyMiller is offline Member
    Join Date
    Jan 2014
    Posts
    20
    Rep Power
    0

    Default Re: Scanner does not read to the end of a very long TXT file

    Well that sums it all up.

    Thanks everyone.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 1
    Last Post: 09-20-2012, 09:54 AM
  2. Read text file with scanner class.
    By frente158 in forum New To Java
    Replies: 3
    Last Post: 03-11-2012, 01:58 PM
  3. Replies: 2
    Last Post: 01-10-2012, 01:10 PM
  4. Using Read/Write From File Using Scanner
    By javaisntcoffee123 in forum New To Java
    Replies: 4
    Last Post: 04-15-2010, 03:35 AM
  5. Replies: 0
    Last Post: 04-17-2008, 07:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •