Fix push messages containing unicode characters
Simplify message parsing

Also adds support for multi-segment messages.
Merge upstream changes