- fix unicode bug found by tcp input tests;

Now: always force the charset, but only convert if it's not UTF-8
This commit is contained in:
Jordan Sissel 2012-12-31 15:29:06 -08:00
parent 648c3834d4
commit 8de740e17a

View file

@ -83,9 +83,9 @@ class LogStash::Inputs::Base < LogStash::Plugin
case @format
when "plain"
raw.force_encoding(@charset)
if @charset != "UTF-8"
# Convert to UTF-8 if not in that character set.
raw.force_encoding(@charset)
raw = raw.encode("UTF-8", :invalid => :replace, :undef => :replace)
end
event.message = raw