diff --git a/lib/logstash/environment.rb b/lib/logstash/environment.rb index 0711abc9f..0d666a540 100644 --- a/lib/logstash/environment.rb +++ b/lib/logstash/environment.rb @@ -117,6 +117,10 @@ module LogStash @jruby ||= !!(RUBY_PLATFORM == "java") end + def windows? + Gem.win_platform? + end + def vendor_path(path) return ::File.join(LOGSTASH_HOME, "vendor", path) end diff --git a/lib/logstash/event.rb b/lib/logstash/event.rb index 18b343ca2..8191fcf31 100644 --- a/lib/logstash/event.rb +++ b/lib/logstash/event.rb @@ -296,6 +296,7 @@ class LogStash::Event def self.validate_value(value) case value when String + value.force_encoding("UTF-8") if LogStash::Environment.windows? raise("expected UTF-8 encoding for value=#{value}, encoding=#{value.encoding.inspect}") unless value.encoding == Encoding::UTF_8 raise("invalid UTF-8 encoding for value=#{value}, encoding=#{value.encoding.inspect}") unless value.valid_encoding? value