Strings from a Sockets Client

It seems Ruby Strings are a mess if you are trying to send them to a
server listening on a given socket (that is not a ruby server. Say it
is a Java server). Has anyone found a workaround for this?

I have a ruby client that must talk to a (running) Java process on the
server – I cannot use JRuby on this one. Therefore, I am trying to
communicate to it via a tcp sockets connection. I think what I need to
do is likely convert the string to an array of integers representing
the string (but even integers are objects in Ruby!). How can I
communicate to a Java Sockets Server in Ruby? Thanks, Janna B