This is similar to UTF-16 data. Therefore try
data[0].rstrip("\n").decode("utf-16")
Edit (for your update): Try to decode the whole file immediately, i.e.
data = open(...).read() data.decode("utf-16")
The problem is that line breaks in UTF-16 are "\ n \ x00", but using readlines() will split into "\ n", leaving the character "\ x00" for the next line.
Sven marnach
source share