Encoding issue reading text file

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Encoding issue reading text file

Masf
Hi everyone,

I´m trying to read a text file with UTF-16LE but I´m getting weird characters like this:
��     W h e n

My code is this one:

    sparkSession
      .read
      .format("text")
      .option("charset", "UTF-16LE")
      .load("textfile.txt")

I´m using Spark 2.3.1. Any idea to fix it?

Thanks
--


Regards.
Miguel Ángel