Class: Utils
- Inherits:
-
Object
- Object
- Utils
- Defined in:
- lib/logstash/filters/utils.rb
Overview
Utility class
Class Method Summary collapse
-
.removeInvalidChars(str) ⇒ Object
Sanitize a UTF 8 string : remove invalid characters.
Class Method Details
.removeInvalidChars(str) ⇒ Object
Sanitize a UTF 8 string : remove invalid characters
7 8 9 10 11 12 |
# 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 |