Closed jordansissel closed 9 years ago
On windows, encoding isn't utf-8, so the tests break:
irb(main):005:0> LogStash::Event.validate_value "hello"
RuntimeError: expected UTF-8 encoding for value=hello, encoding=#<Encoding:Windows-1252>
from C:/lswin/logstash-cmdexe/lib/logstash/event.rb:299:in `validate_value'
This is called from logstash-devutils in the rspec_helpers we use:
class LogStash::Event
alias_method :setval, :[]=
def []=(str, value)
if str == TIMESTAMP && !value.is_a?(LogStash::Timestamp)
raise TypeError, "The field '@timestamp' must be a LogStash::Timestamp, not a #{value.class} (#{value})"
end
LogStash::Event.validate_value(value)
setval(str, value)
end # def []=
end
Commenting the validate_value makes tests pass. Otherwise the tests can be changed to force the input strings to be utf-8
The encoding should always be UTF-8 within logstash
expected UTF-8 encoding for value=sadness
Ahh. 'sadness' is my hostname. Socket.gethostname returns strings in host encoding. There's a jruby bug I filed about this somewhere.
sadness ensues
fixed in a monkeypatch in https://github.com/elasticsearch/logstash/pull/2507
From https://github.com/elasticsearch/logstash/issues/2487