0

I want to use encrypted data as a value for a property. I did something like this using Turtle :

:s :p """<85>^A^L^C<88>-[Ä÷¯¨ç^A^Gý^]^\ä²tðáê½?­^Q<9f>6 <8b>ÏÂ43àñoú]:ëÜ^YÕþá>:³Æ÷ýé<8c>%¨6±<8b>^]oI^^^S"<96>^CiÓ­<95>Ë´Ú^X^D"""^^^xsd:base64Binary .

and got "..illegal escape sequence value: ä (0xE4)" when I checked the file with Jena riot.

How do I correctly put binary data into a value in Turtle?

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Interition
  • 381
  • 2
  • 15

2 Answers2

3

Your problem is that the string is not a Base64 encoded one. A Base64 string only contains ASCII characters.

Your string would be encoded like this:

PDg1Pl5BXkxeQzw4OD4tW8OEw7fCr8Kow6deQV5Hw71eXV5cw6TCsnTDsMOhw6rCvT/CrV5RPDlmPjYgPDhiPsOPw4I0M8Ogw7Fvw7pdOsOrw5xeWcOVw77DoT46wrPDhsO3w73DqTw4Yz4lwqg2wrE8OGI+Xl1vSV5eXlMiPDk2Pl5DacOTwq08OTU+w4vCtMOaXlheRA==

See https://en.wikipedia.org/wiki/Base64

enridaga
  • 631
  • 4
  • 9
  • thanks for the response. I tried as :s :p """<85>^A^L^C<88>-[Ä÷¯¨ç^A^Gý^]^\ä²tðáê½?­^Q<9f>6 <8b>ÏÂ43àñoú]:ëÜ^YÕþá>:³Æ÷ýé<8c>%¨6±<8b>^]oI^^^S"<96>^CiÓ­<95>Ë´Ú^X^D""" and got the same error. So the question is how do I represent this binary data? – Interition Oct 15 '15 at 13:14
  • You pasted the same non-ASCII string in your comment. You should do something like: :s :p """PDg1Pl5BXkxeQzw4OD4tW8OEw7fCr8Kow6deQV5Hw71eXV5cw6TCsnTDsMOhw6rCvT/CrV5RPDlmPjYgPDhiPsOPw4I0M8Ogw7Fvw7pdOsOrw5xeWcOVw77DoT46wrPDhsO3w73DqTw4Yz4lwqg2wrE8OGI+Xl1vSV5eXlMiPDk2Pl5DacOTwq08OTU+w4vCtMOaXlheRA==""" instead. – enridaga Oct 15 '15 at 13:43
2

after my friend spelled out the obvious to me I realize the answer is to convert my binary data to base64. I used OpenSSL as follows:

cat binarydata.bin | openssl enc -base64

Interition
  • 381
  • 2
  • 15