class Utils

Utility class

Public Class Methods

removeInvalidChars(str) click to toggle source

Sanitize a UTF 8 string : remove invalid characters

# File lib/logstash/filters/utils.rb, line 7
def self.removeInvalidChars(str)
  if(str && !str.valid_encoding?)
    return str.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: "")
  end
  return str
end