Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
Force encoding to UTF-8 for response on ruby 1.9.x, as we receive UTF…
Browse files Browse the repository at this point in the history
…-8 QString only from server.

This fix the failing spec related to UTF-8 encoding checks. It's not the best solution,
but TCPSocket on Ruby 1.9.x defaults to ASCII-8bit, the server sends responses as
UTF-8 encoded string only.
  • Loading branch information
JonathanTron committed May 20, 2011
1 parent b748573 commit a759712
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/capybara/driver/webkit/browser.rb
Expand Up @@ -103,7 +103,12 @@ def check

def read_response
response_length = @socket.gets.to_i
@socket.read(response_length)
response = @socket.read(response_length)
if response.respond_to?(:encoding)
response.force_encoding "UTF-8"
else
response
end
end
end
end

0 comments on commit a759712

Please sign in to comment.