! Fix websocket writer not correctly serializing UTF-8 text

While debugging the logstash setup at my workplace I have encountered a problem when sending JSON containing UTF-8 multibyte characters via the websocket output. The problem was a missing '}' at the end of the JSON data which was triggered by a multibyte character in one of the fields.

Since this a rather plain "byte size != string length" problem which is easily overlooked when serializing strings, I went spelunking for the culprit.

After digging through the dependencies I ended up at ruby-ftw and I was able to improvise a patch. I have absolutely no experience with Ruby, the patch is made up of 50% googling and 50% guessing. It works for our setup, but I do not know enough ruby to set up unit tests. So I understand if the patch will not be pulled as is. At least it can serve as a reasonably detailed bug report.