xmpp4r/xmpp4r — pull request #15 by whitehat101 (2013-10-17 00:09:36+00:00)
Title: Prevent REXML exceptions on UTF-8 messages

Fixes #13

It turns out that `SSLSocket` does nothing to support encodings. On plain ASCII strings, it creates strings with encodings of `UTF-8`, but when it encounters a string that actually contains UTF-8 characters, it claims the encoding is `ASCII-8BIT`.

`REXML` requires UTF-8, and since the `SSLSocket` changes encoding mid-session, it cannot react to the change of encoding.

This patch wraps `SSLSocket` and ensures that all strings have an encoding of `UTF-8`

I spoke with a ruby-core developer, and he plans on including encoding support for `SSLSocket` in 2.1, but this fix will work with current rubies.