From 504d5c62efeb14ecd703ca5f67006e067edab22b Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 18 Mar 2022 14:18:07 +0100 Subject: [PATCH] Fixed wrong encoding error --- src/main/java/ch/zhaw/pm2/racetrack/Track.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Track.java b/src/main/java/ch/zhaw/pm2/racetrack/Track.java index 5dab127..640fe3e 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Track.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Track.java @@ -3,8 +3,7 @@ package ch.zhaw.pm2.racetrack; import ch.zhaw.pm2.racetrack.given.ConfigSpecification; import ch.zhaw.pm2.racetrack.given.TrackSpecification; -import java.io.File; -import java.io.FileNotFoundException; +import java.io.*; import java.util.ArrayList; import java.util.List; import java.util.Scanner; @@ -85,10 +84,9 @@ public class Track implements TrackSpecification { * @throws FileNotFoundException if the FilePath is invalid. */ private void readFile(File trackFile) throws FileNotFoundException { - Scanner scanner = new Scanner(trackFile); + Scanner scanner = new Scanner(new FileInputStream(trackFile),"UTF-8"); while (scanner.hasNextLine()) { - //track.add(scanner.nextLine()); - System.out.println(scanner.nextLine()); + track.add(scanner.nextLine()); } }