I ended up using the RawDeflate library to achieve compression of around thirty to fifty percent. This performed better than all the methods listed in the SO question linked in the comments.
I wrote the following Ruby class for inflating data on the server.
require "zlib"
require "base64"
class Decompression
# Decompress content sent to the server.
#
# Usage:
#
# Decompression.decompress(params["raw_content"])
#
# Returns string.
def self.decompress(string)
decoded = Base64.decode64(string)
inflate(decoded).force_encoding('UTF-8')
end
private
# https://stackoverflow.com/q/1361892/574190
def self.inflate(string)
zstream = Zlib::Inflate.new(-Zlib::MAX_WBITS)
buf = zstream.inflate(string)
zstream.finish
zstream.close
buf
end
end