Socket Connection to Server and Response is in ISO 8859-1 charset

Hi,

in my little rail application I have to communicate with a server and
everything works great. Except one issue:
The server responses are in ISO 8859-1 charset and it seems that I am
not able to convert that to utf-8 correctly, which leads to an
exception in my mysql insert statement. (seems that one of our German
extra characters)

Could please somebody help me and explain how to convert my server
response correctly?

That s the code I am currently using:
Timeout::timeout(2) do
@client = TCPSocket.open(server[:name], server[:port])
end

get initial hello from server

server_response = @client.gets

@client.send(command.get_command(), 0)
while ((command.response.nil? || !command.response.complete?) &&
(response_line = @client.gets()))
command.set_response(my_parser.parse_response(response_line,
command.retrieve_command?))
end


Volker

Ok… do not trust your dos box…

A simple: response_line = Iconv.conv(‘utf-8’, ‘ISO-8859-1’,
response_line)
did the trick.

On 6 Feb., 21:59, “[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs