diff --git a/lib/tty/file.rb b/lib/tty/file.rb
index <HASH>..<HASH> 100644
--- a/lib/tty/file.rb
+++ b/lib/tty/file.rb
@@ -584,7 +584,7 @@ module TTY
     # @api public
     def replace_in_file(relative_path, *args, **options, &block)
       check_path(relative_path)
-      contents = ::File.binread(relative_path)
+      contents = ::File.read(relative_path)
       replacement = (block ? block[] : args[1..-1].join).gsub('\0', '')
       match = Regexp.escape(replacement)
       status = nil
@@ -596,7 +596,7 @@ module TTY
       if options.fetch(:force, true) || !(contents =~ /^#{match}(\r?\n)*/m)
         status = contents.gsub!(*args, &block)
         if !status.nil?
-          ::File.open(relative_path, 'wb') do |file|
+          ::File.open(relative_path, 'w') do |file|
             file.write(contents)
           end
         end
Change to fix character encoding and close issue #9