Active resource and binary data for sqlite3

I posted some data to a webserver using ActiveResource, it seemed I
needed to encode the binary data to Base64 for it to work. When I
tried to read the data back and decode it from Base64 it seemed like I
had to decode it twice which baffled me how it could have been double
encoded when I only encoded it once ?