# File lib/facter/util/normalization.rb, line 58 def normalize_string(value) value = value.encode(Encoding::UTF_8) unless value.valid_encoding? raise NormalizationError, "String #{value.inspect} doesn't match the reported encoding #{value.encoding}" end value rescue EncodingError raise NormalizationError, "String encoding #{value.encoding} is not UTF-8 and could not be converted to UTF-8" end