I keep getting an Encoding::UndefinedConversionError - "\\xC2" from ASCII-8BIT to UTF-8 every time I try to convert a hash into a JSON string. I tried
Encoding::UndefinedConversionError - "\\xC2" from ASCII-8BIT to UTF-8
If you don't care about losing the strange characters, you can blow them away:
str.force_encoding("ASCII-8BIT").encode('UTF-8', undef: :replace, replace: '')