Encoding.compatible?(obj1, obj2) â enc or nil
Class Public methods
Checks the compatibility of two objects.
If the objects are both strings they are compatible when they are
concatenatable. The encoding of the concatenated string will be returned
if they are compatible, nil if they are not.
Encoding.compatible?("\xa1".force_encoding("iso-8859-1"), "b")
#=> #<Encoding:ISO-8859-1>
Encoding.compatible?(
"\xa1".force_encoding("iso-8859-1"),
"\xa1\xa1".force_encoding("eu