How can I apply UTF8 encoding properly when writing a dataframe into a CSV file in Spark2-Scala? I am using this:
df.repartition(1).write.mode(SaveMode.Overwrite)
.format("csv").option("header", true).option("delimiter", "|")
.save(Path)
And it is not working: example: replacing é to weird strings.
Thank you.
encodingoption explicitly toUTF-8, though that's the default encoding if the option is unset. Perhaps Spark is running with a different locale..option("encoding", "UTF-8").