Fix parsing when messages contain UTF-8.

idxTerminator was an offset in characters, which was then incorrectly
used as byte offset when slicing the buffer.

Now, we look for the header terminator in the buffer, and postpone
string decoding until after we've sliced.
Merge pull request #8 from stephank/patch-1

Fix parsing when messages contain UTF-8.