diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb
index <HASH>..<HASH> 100644
--- a/lib/fluent/plugin/in_tail.rb
+++ b/lib/fluent/plugin/in_tail.rb
@@ -687,12 +687,12 @@ module Fluent::Plugin
 
         def convert(s)
           if @need_enc
-            s.encode(@encoding, @from_encoding)
+            s.encode!(@encoding, @from_encoding)
           else
             s
           end
         rescue
-          s.encode(@encoding, @from_encoding, :invalid => :replace, :undef => :replace)
+          s.encode!(@encoding, @from_encoding, :invalid => :replace, :undef => :replace)
         end
 
         def next_line
in_tail: Use encode! instead of encode to improve the performance