0

I have a text file, which contains lines with data(key-values pairs):

"\x80\x80\x13_@\x80":"\xff\xff\x80Sometext\x56\"\x64\u0001(more bytes with unicode reprsentation and unicode and latin symbols)\xfdg\u0080moretext\x30中\x52\x23\x24P" (maybe \U00000000 (not sure))

(it is mixed actually and I have hard time understanding how to convert this to bytes format because I need data from the file.

When I read as bytes I have hard time figuring how to deal with it. If I read as text it has two \ before.

(it is a dump from golang/leveldb, I wanted to split it to extract the wav data).

1 Answers1

1

if its a string (or unicode in py2) you can just call my_string.encode("utf8") since I believe that all characters in unicode can be represented in utf8(take with a grain of salt) ... (note not all bytes necessarily so if you have weird random binary data in there too that probably would not work so well)

if its already in bytes its harder... you really would need to know the appropriate encoding

Joran Beasley
  • 110,522
  • 12
  • 160
  • 179
  • It is a python 3. It is just a text file when I open it in sublime text it looks similar to that string. – user11822602 May 20 '20 at 07:53
  • I think I am asking in a wrong place wrong question. I have (had a task) to get data from an Indexed Database from Chrome. (Mac, version is unknown). I can easilly get data from console with a javascript but database is not recognizable by Chrome. It just deletes all files after I copy them to the folder of the site's db. Opening db files with python packages has shown that there are some string comparator should be present (I don't know anything of c++ to go and research Chromium implementation of this database.) Is there any way to get data from Chrome IndexedDb (from windows)? – user11822602 May 20 '20 at 07:58
  • Im not familliar with the indexDB files but a quick search came up with this https://stackoverflow.com/questions/53704997/getting-data-inside-a-google-chrome-indexeddb-from-bash-or-python – Joran Beasley May 20 '20 at 08:01
  • Thank you. plyvel doesn't work in windows but I will try it on linux. – user11822602 May 20 '20 at 08:05