I want to write a GBK encoding csv file from a DataFrame. I find the option "encoding" in CSVOptions and it works well when I read a GBK encoding file with option("encoding", "GBK") in local environment. But when I use the write function like below
df.repartition(1).write.option("header", value = true).option("encoding", "GBK").csv("F:\\project\\test1")
The csv file I got is always in UTF8 encoding. I have tried to change the encoding option value to ISO-8859-1 or another encoding format, it doesn't change the output csv file encoding.