0

I'm trying to fetch and display jpeg image data from my Arduino server.

So on one side (arduino part), I read some data and file's data from sd card and put it (bytes) in a text/plain response, separated with ";".

On the other side, I receive encrypted data as (just the beginning) :

144;0;31.00;25.00;585;1;����$.C�@2QQ���             �����@!���      }!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������������������������������������������������������������w!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz

I split this, do stuff with the first part :

144;0;31.00;25.00;585;1;

and want to take the image data following, and display the corresponding image.

I guess I have to convert the string to base64 with something like that:

"data:image/jpeg;base64,"+data

but I'm not sure of the nature of the received data from Arduino (string ? hex ? bytes ?...)

I tried btoa() but error says the string to be encoded contains non latin1 characters...

2
  • You are asking about Base64 but the real question is sending and receiving .jpg data from an Arduino server something else. Consider changing the question an title to reflect what you are trying to accomplish, Base64 may not even be needed. This is know as an XY question where the problem is X and the question is Y.
    – zaph
    Commented Jun 11, 2016 at 19:22
  • What language is the sending part in? And what does receive your message? an App or Webpage? Commented Jun 22, 2016 at 13:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.