Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cinch quick fix
diff --git a/lib/cinch/utilities/encoding.rb b/lib/cinch/utilities/encoding.rb
index 2a248e2..a4d1bcb 100644
--- a/lib/cinch/utilities/encoding.rb
+++ b/lib/cinch/utilities/encoding.rb
@@ -17,7 +17,7 @@ module Cinch
string.force_encoding("CP1252").encode!("UTF-8", {:invalid => :replace, :undef => :replace})
end
else
- string.force_encoding(encoding).encode!({:invalid => :replace, :undef => :replace})
+ string.force_encoding(encoding).encode!("UTF-8", {:invalid => :replace, :undef => :replace})
string = string.chars.select { |c| c.valid_encoding? }.join
end
@@ -44,7 +44,7 @@ module Cinch
rescue ::Encoding::UndefinedConversionError
end
else
- string.encode!(encoding, {:invalid => :replace, :undef => :replace})
+ string.encode!(encoding, {:invalid => :replace, :undef => :replace}).force_encoding("binary")
end
return string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.