Ruby implementation: ensure text encoding is raw