Avoid corruption of unicode strings

The message is accumulated in string parts, which might break if the buffer boundary happens to be in the middle of a multi-byte char. Instead, accumulate the data in a buffer and convert it to a string when it has all been received.

Jira issue: wp-737