I read data from file and write to destination after some transfomations.
the case :
val schema1file = Source.fromFile(s"$path", "UTF-8")
val writer = new PrintWriter(new File(s"$targetPath"))
val lines = schema1file.getLines().toArray
for (i <- 0 until lines.length) {
val line = lines(i).toString()
// todo
writer.println(line)
}
writer.close
It works and save my output right.But I always find the 'FEFF' at the very beginning of the outputfile and the place I use s"$var$var1".
Could you help to tell me why and how to fix it? Thanks@