Skip to content

Commit

Permalink
Fixed a couple of 1.8.7 bugs - closes #85
Browse files Browse the repository at this point in the history
  • Loading branch information
mloughran committed Jul 12, 2012
1 parent 3896511 commit 093d5fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/em-websocket/connection.rb
Expand Up @@ -161,7 +161,8 @@ def send(data)

# Revert data back to the original encoding (which we assume is UTF-8)
# Doing this to avoid duping the string - there may be a better way
data.force_encoding(UTF8)
data.force_encoding(UTF8) if ENCODING_SUPPORTED
return nil
end

# Send a ping to the client. The client must respond with a pong.
Expand Down
3 changes: 2 additions & 1 deletion lib/em-websocket/masking04.rb
Expand Up @@ -29,7 +29,8 @@ def getbyte(index)
end

def getbytes(start_index, count)
data = ''.force_encoding('ASCII-8BIT')
data = ''
data.force_encoding('ASCII-8BIT') if data.respond_to?(:force_encoding)
count.times do |i|
data << getbyte(start_index + i)
end
Expand Down

0 comments on commit 093d5fe

Please sign in to comment.