0

I'm trying to read a config for a sudoku type game from a file, line by line, and then separate the line into useable data.

However, when I try to save it as a string, the lines with a '÷' show up strangely

if (file != null && file.exists() && file.canRead()) {
try {
    //For each line manipulate the data for processing
    BufferedReader buffered = new BufferedReader(new FileReader(file));
    String currentLine;
    while((currentLine = buffered.readLine()) != null) {
        target = currentLine.split(" ")[0];
        System.out.println(target);
        ids = (currentLine.split(" ")[1]).split(",");
        .....
    }
    buffered.close();

The first two lines of the file are:

11+ 1,7

and

2÷ 2,3

The result of my debugging print statement is:

11+
java.lang.NumberFormatException: For input string: "2Ã"
2÷

So I believe the ÷ is showing up as à for some reason.

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
Peter
  • 848
  • 8
  • 14

0 Answers0