diff --git a/lib/baby_erubis.rb b/lib/baby_erubis.rb
index <HASH>..<HASH> 100644
--- a/lib/baby_erubis.rb
+++ b/lib/baby_erubis.rb
@@ -40,7 +40,9 @@ module BabyErubis
     end
 
     def from_file(filename, encoding='utf-8')
-      input = File.open(filename, "rb:#{encoding}") {|f| f.read() }
+      mode = "rb:#{encoding}"
+      mode = "rb" if RUBY_VERSION < '1.9'
+      input = File.open(filename, mode) {|f| f.read() }
       compile(parse(input), filename, 1)
       return self
     end
ruby: change 'Template#from_file()' to support Ruby <I>