0

I am trying to convert this line of raw data into hex within my program.

However I am getting this error: enter image description here

This is the line of raw data i am trying to convert:

PQ= (3< Ú Âq*Åž‰ü 'a

Here is what the line looks like in notepad:

textcoded

from what I can tell is that the -> symbol in the raw data text is causing my " " marks to close or end.

My goal is to create a function that can convert raw data lines like the one shown above into Hexadecimal.

So far i can tell that the key that is causing the error is the -> symbol which appears as a blank space in the IDE.

Upon using an online converter I see that the symbol in hex for UTF-8 is 1A and I'm not sure how to decode this line in order to read it in my IDE correctly.

Here is a paste bin of the raw data text: http://pastebin.com/q4p7j6gU

I'm trying to use base64 library in order to try to decode this line:

import base64
base64.b64decode(b"""   PQ=
(3<   Ú    Âq*Åž‰ü       'a""") 
JeanP
  • 406
  • 9
  • 27
  • Are you sure you are saving your source as UTF-8? And why not use escape sequences like `\xhh` or `\uhhhh` instead? – Martijn Pieters Dec 16 '15 at 14:40
  • As you can see Stack Overflow isn't accepting the data as you see it in Notepad *either* – Martijn Pieters Dec 16 '15 at 14:41
  • The issue is I have the text document filled with similar lines that cause this issue. So while I scan the file line by line grabbing data to convert I get this EOF error due to these special characters. I did save my source as UTF-8 however the symbols only appear in NotePad. Anywhere else will just show either blank or empty spaces. – JeanP Dec 16 '15 at 14:44
  • I'd put this data in a separate file and read that; why does this data have to be embedded in your source code? – Martijn Pieters Dec 16 '15 at 14:46
  • It's only embedded in order to test and try to fix it and so I can see were the error is. It is in a separate file. – JeanP Dec 16 '15 at 14:48

0 Answers0