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...