Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So I figured out a bug where an emoji might transform the string into a defective string. To put an example: A message is 149 characters of text followed by Hello 🔋, for a total of 159 bytes. Only 156 bytes fit in the frame. The emoji 🔋 is 4 bytes: F0 9F 94 8B.
Current code: it cuts at exactly 156 bytes and keeps only the first byte of the emoji:
The app shows something like ...Hello �.
With the fix: the cut lands inside the emoji, so it moves back and drops the whole character:
The app shows ...Hello , which is a valid text.
Now, for the record, I have just figured this out, but, at least the IOS app, handles this by checking the message length before sending it, taking into account the emoji length. My approach is, in case a sender without this kind of verification sends the message, a receiver doesn't receive a bad string.
The only draw I see is that, some emojis that occupies too much due to the amount of attributes such as the tone color an emoji can have, the truncation will may take as valid half of the emoji, meaning it may send the emoji with a slight difference.
3 test created, 3 test passed in WSL.