Emoji affects entity offsets
Entity offsets and lengths use UTF-16 code units, independently of string transport encoding. Neither UTF-8 byte length nor a visual character count is a substitute. Test emoji and combining sequences at formatting boundaries. Parse supported formatting into entities instead of executing user-supplied HTML.
Mentions are not limited to usernames
Entities support username-based and identity-based mentions. Unread mentions have their own counters and read operations; they are not simply the dialog’s unread-message count.
Drafts synchronize across devices
Saving, updating and clearing a draft are separate actions. Coordinate draft clearing with sending; media captions can also start from a draft.
Editor recommendations
Test Chinese text, emoji, line breaks, links and multiple formatting spans through both send and retrieval. Preserve a failed message as a draft and partition drafts by account. Clearing the input field is not evidence that a message was delivered.