Couple remaining fixes to be 4-byte UTF-8 compatible. Tested with https://twitter.com/NeeOmy/status/493133427172835328 and it all worked fine.