Fix JS decoding for unicode surrogate pairs

This issue was exposed by emoticons being encoded differently in
messages using the new API.