lib/riddle/client/message.rb in riddle-0.9.8.1231.0 vs lib/riddle/client/message.rb in riddle-0.9.8.1533.10

- old
+ new

@@ -8,17 +8,18 @@ @size_method = @message.respond_to?(:bytesize) ? :bytesize : :length end # Append raw data (only use if you know what you're doing) def append(*args) - return if args.length == 0 - args.each { |arg| @message << arg } end # Append a string's length, then the string itself def append_string(str) - @message << [str.send(@size_method)].pack('N') + str + string = str.respond_to?(:force_encoding) ? + str.dup.force_encoding('ASCII-8BIT') : str + + @message << [string.send(@size_method)].pack('N') + string end # Append an integer def append_int(int) @message << [int].pack('N') \ No newline at end of file