logstash/lib/bootstrap/patches/gems.rb
Pere Urbon-Bayes 829af589cd wrap usage of Gems.versions withing a patch that forces UTF-8 encoding
locate the patch to his own location

rename patches directory

Fixes #5486
2016-06-15 06:45:43 -04:00

16 lines
700 B
Ruby

# encoding: utf-8
require "gems"
# This patch is necessary to avoid encoding problems when Net:HTTP return stuff in ASCII format, but
# consumer libraries, like the YAML parsers expect them to be in UTF-8. As we're using UTF-8 everywhere
# and the usage of versions is minimal in our codebase, the patch is done here. If extended usage of this
# is done in the feature, more proper fix should be implemented, including the creation of our own lib for
# this tasks.
module Gems
module Request
def get(path, data = {}, content_type = 'application/x-www-form-urlencoded', request_host = host)
request(:get, path, data, content_type, request_host).force_encoding("UTF-8")
end
end
end