lib/bencodr/io.rb in bencodr-2.0.1 vs lib/bencodr/io.rb in bencodr-3.0.0
- old
+ new
@@ -1,5 +1,7 @@
+# encoding: UTF-8
+
module BEncodr
module IO
module ClassMethods
def bencode(fd, object)
open(fd, "wb") {|file| file.bencode(object)}
@@ -13,10 +15,10 @@
def bencode(object)
write(Object.bencode(object))
end
def bdecode
- Object.bdecode(read)
+ Object.bdecode(read.force_encoding('UTF-8'))
end
def self.included(base)
base.extend ClassMethods
end
\ No newline at end of file