I'm currently using Java 1.4.2 on the client side to talk to a Rails 3 server. When we originally designed the communication, all the information returned was ASCII (alphanumeric), so we would use JSON and return it as a map. Now we find the need to return binary data (an image) as well, but we don't want to make two HTTP requests.
What's the best way to send the existing ASCII information and the binary data in one HTTP response? My current thought is to use base64 or hex-encoding, but I don't know if that's the best way. An easy way to encode on the server (Ruby) side and decode on the client (Java 1.4.2) is also a huge plus.