Method: Fluent::Plugin::Base#string_safe_encoding

Defined in:
lib/fluent/plugin/base.rb

#string_safe_encoding(str) {|str| ... } ⇒ Object

Yields:

  • (str)


90
91
92
93
94
95
96
# File 'lib/fluent/plugin/base.rb', line 90

def string_safe_encoding(str)
  unless str.valid_encoding?
    str = str.scrub('?')
    log.info "invalid byte sequence is replaced in `#{str}`" if self.respond_to?(:log)
  end
  yield str
end