UTF-8 to UTF-16 should never raise UndefinedConversionError

This commit is contained in:
Jack Nagel 2014-11-18 01:21:50 -06:00
parent 7f230dfaf8
commit a9e34b0ee2

View File

@ -146,7 +146,7 @@ module Homebrew
return str if str.valid_encoding?
# Assume we are starting from a "mostly" UTF-8 string
str.force_encoding(Encoding::UTF_8)
str.encode!(Encoding::UTF_16, :invalid => :replace, :undef => :replace)
str.encode!(Encoding::UTF_16, :invalid => :replace)
str.encode!(Encoding::UTF_8)
end
else