lib/origami/file.rb in origami-1.2.2 vs lib/origami/file.rb in origami-1.2.3

- old
+ new

@@ -46,15 +46,21 @@ if path.respond_to?(:read) fd = path params[:EmbeddedName] ||= '' else - fd = File.open(path, 'r').binmode + fd = File.open(File.expand_path(path), 'r').binmode params[:EmbeddedName] ||= File.basename(path) end fstream = EmbeddedFileStream.new - fstream.data = fd.read + + if ''.respond_to? :force_encoding + fstream.data = fd.read.force_encoding('binary') # 1.9 + else + fstream.data = fd.read + end + fstream.setFilter(params[:Filter]) name = params[:EmbeddedName] fspec = FileSpec.new.setType(:Filespec).setF(name.dup).setEF( FileSpec.new(:F => fstream)