force UTF-8 encoding for gem file reading

This commit is contained in:
Colin Surprenant 2017-08-24 18:11:48 -04:00
parent b982a1ecbe
commit c94d3d628e

View file

@ -16,6 +16,9 @@ module LogStash
end
def load(with_backup = true)
# encoding must be set to UTF-8 here to avoid ending up with Windows-1252 encoding on Windows
# which will break the DSL instance_eval of that string
@io.set_encoding(Encoding::UTF_8)
@gemset ||= DSL.parse(@io.read)
backup if with_backup
self