Fixed wrong encoding error

This commit is contained in:
Andrin Fassbind 2022-03-18 14:18:07 +01:00
parent 848d62a5f9
commit 504d5c62ef
1 changed files with 3 additions and 5 deletions

View File

@ -3,8 +3,7 @@ package ch.zhaw.pm2.racetrack;
import ch.zhaw.pm2.racetrack.given.ConfigSpecification; import ch.zhaw.pm2.racetrack.given.ConfigSpecification;
import ch.zhaw.pm2.racetrack.given.TrackSpecification; import ch.zhaw.pm2.racetrack.given.TrackSpecification;
import java.io.File; import java.io.*;
import java.io.FileNotFoundException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Scanner; import java.util.Scanner;
@ -85,10 +84,9 @@ public class Track implements TrackSpecification {
* @throws FileNotFoundException if the FilePath is invalid. * @throws FileNotFoundException if the FilePath is invalid.
*/ */
private void readFile(File trackFile) throws FileNotFoundException { private void readFile(File trackFile) throws FileNotFoundException {
Scanner scanner = new Scanner(trackFile); Scanner scanner = new Scanner(new FileInputStream(trackFile),"UTF-8");
while (scanner.hasNextLine()) { while (scanner.hasNextLine()) {
//track.add(scanner.nextLine()); track.add(scanner.nextLine());
System.out.println(scanner.nextLine());
} }
} }