Fix encoding of strings sent to the server.
