Java scanner not going through entire file

后端 未结 8 1099
悲&欢浪女
悲&欢浪女 2020-11-30 11:31

I\'m writing a program in Java and one of the things that I need to do is to create a set of every valid location for a shortest path problem. The locations are defined in a

8条回答
  •  忘掉有多难
    2020-11-30 11:43

    I was having the same problem. The scanner would not read to the end of a file, actually stopping right in the middle of a word. I thought it was a problem with some limit set on the scanner, but I took note of the comment from rfeak about character encoding.

    I re-saved the .txt I was reading into UTF-8, it solved the problem. It turns out that Notepad had defaulted to ANSI.

提交回复
热议问题