0

I am trying to decrypt data from a file, so this is what I did. first I read the file as "rb" and found type to be of List and then when I print the first index this is what I get: b'H\x08\x00\xdf\xcf\xf9\x982\r\x9c\x12GD\x00(\xb2\x00\x00dGT>|\x0eK\xbe\xca6\x86\xc1<-O@\xd9\x84\x97:dGT>o\xd7\x12\xc0\xbc\x86\xf3=\x08\xf2\x8a\xb6>*\xd7\xba\x00k\xb2\xb87I\rEY\x98\x8dC)\xc3b\xc6\xca\xd7\xa5\xc0\xbb\xa7A<H\x08\x00\x8e\x8f\x0b\x992\r\x9c\x12GD\x00(\xb2\x00\x00.\rX>\x0e:O\xbe"G\x8a\xc1\xfb\xb8Q@\xdd\xb3\x96:R\x89U>\xb1\xfd\x0b\xc0\x8bJ\xec=P\x8a\x85\xb66\xb8\xe3\xba,/\xc0\xb8\xb6b\x04Ee\xdf\x89C\xdc\xe4j\xc6P\xca\xa8\xc0\xf8\xd2?<H\x08\x00\x8e\x8f\x0b\x992\r\x9c\x12I\x08\x00(\xb2\x00\x00.\rX>H\x08\x00\x1c\xa6\xff\x982\r\x9c\x12GD\x00$\xc2\x00\x00\x85\xeaq>\xb2O\xbc\xbe\xab\xca\xce\xc16\r\x8c@\xf4\x02\xb4:\x85\xeaq>\x96\x8c\x12\xbf\x9e|\n'

I tried - data[0] dot decode ( "UTF-8" ) I got - UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdf in position 3: invalid continuation byte

I tried - print ( data [0] dot decode ( "latin-1" ) ) I got - �2

I tried other encodings but I get the above result only.

I would be grateful for any or all help.

  • what type of file are you reading from? – Farid Fakhry Jul 06 '22 at 16:51
  • the file holds options data from exchange but there is no extension – adroit algos Jul 06 '22 at 18:35
  • as far as i know, you can not know for sure the encoding of a file it is usually sent as meta data. you could try opening the file in notepad and save as, if the encoding is recognized it should prompt you [helpful post](https://stackoverflow.com/questions/3710374/get-encoding-of-a-file-in-windows) – Farid Fakhry Jul 06 '22 at 20:35

0 Answers0