Browse files

Force code PDU body to binary for 1.9

  • Loading branch information...
1 parent 8013dbd commit f931191106cb60cf6ca367d62cf2c931c3575a5a @nikitug nikitug committed Mar 25, 2013
Showing with 5 additions and 4 deletions.
  1. +5 −4 lib/smpp/pdu/base.rb
View
9 lib/smpp/pdu/base.rb
@@ -71,7 +71,7 @@ class Base
SEQUENCE_MAX = 0x7FFFFFFF
- # PDU sequence number.
+ # PDU sequence number.
@@seq = [Time.now.to_i]
# Add monitor to sequence counter for thread safety
@@ -82,14 +82,15 @@ class Base
attr_reader :command_id, :command_status, :sequence_number, :body, :data
- def initialize(command_id, command_status, seq, body='')
+ def initialize(command_id, command_status, seq, body='')
length = 16 + body.length
@command_id = command_id
@command_status = command_status
+ body.force_encoding("binary") if body.respond_to?(:force_encoding)
@body = body
@sequence_number = seq
- @data = fixed_int(length) + fixed_int(command_id) + fixed_int(command_status) + fixed_int(seq) + body
- end
+ @data = fixed_int(length) + fixed_int(command_id) + fixed_int(command_status) + fixed_int(seq) + body
+ end
def logger
Smpp::Base.logger

0 comments on commit f931191

Please sign in to comment.