Method: Cinch::Utilities::Encoding.encode_outgoing

Defined in:
lib/cinch/utilities/encoding.rb

.encode_outgoing(string, encoding) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



29
30
31
32
33
34
35
36
# File 'lib/cinch/utilities/encoding.rb', line 29

def self.encode_outgoing(string, encoding)
  string = string.dup
  if encoding == :irc
    encoding = "UTF-8"
  end

  string.encode!(encoding, invalid: :replace, undef: :replace).force_encoding("ASCII-8BIT")
end