electric-sheep-co / arduino-redis

A Redis client library for Arduino.
http://arduino-redis.com
MIT License
52 stars 19 forks source link

"get" with binary data? #35

Open egradman opened 3 years ago

egradman commented 3 years ago

Hi, I'm using this library on a Teensy 3.2 with a Wiznet adapter and it's working great so far. Thanks for writing it!

I'm storing binary data in a redis key and trying to GET it on the teensy. What I think I'm seeing is that embedded NULL bytes are causing the received data to be incomplete. Am I correct that this library isn't designed to handle data values with NULL characters?

This isn't blocking me; my workaround is to base64 encode the data on the server and decode it on the device, which is working well and a hack I can totally live with.

rpj commented 3 years ago

HI @egradman,

Apologies for the delayed response! You are correct that currently the library doesn't allow embedded zero/NULL bytes as it views most everything as a String. This is definitely something I've considered adding an implementation for, presumably via a runtime configuration, but as with many things I haven't found the time for it yet. 😄

Generally speaking most people find the method you're already using - base64 encoding - to work pretty well, but if you do find it hampers you and would like raw binary support added, please feel free to submit a PR. Either way, this is something I do intend to add at some point in the future so will keep this issue open to track that, but I cannot provide any timeline as to when I'll get to it.

Thanks a ton for reaching out and using the library, it is very much appreciated!