Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compose: Enforce max topic/content length by Unicode code points, not UTF-16 code units #1238

Open
chrisbobbe opened this issue Dec 30, 2024 · 0 comments · May be fixed by #1239
Open

compose: Enforce max topic/content length by Unicode code points, not UTF-16 code units #1238

chrisbobbe opened this issue Dec 30, 2024 · 0 comments · May be fixed by #1239
Labels
a-compose Compose box, autocomplete, attaching files/images

Comments

@chrisbobbe
Copy link
Collaborator

We have this comment where we decide if the content input is too long:

      // normalized.length is the number of UTF-16 code units, while the server
      // API expresses the max in Unicode code points. So this comparison will
      // be conservative and may cut the user off shorter than necessary.
      if (textNormalized.length > kMaxMessageLengthCodePoints)

This issue is to stop cutting the user off shorter than necessary, while not regressing on performance in the common case where the length isn't approaching the limit.

This applies equally to topic lengths, where the server limit is also expressed in Unicode code points. For example, on CZO where the topic limit is 60 code points, we're not accepting '👨‍👩‍👦👨‍👩‍👦👨‍👩‍👦👨‍👩‍👦👨‍👩‍👦👨‍👩‍👦👨‍👩‍👦👨‍👩‍👦👨‍👩‍👦👨‍👩‍👦👨‍👩‍👦👨‍👩‍👦' (60 code points), but we should accept it because the server does.

@chrisbobbe chrisbobbe added the a-compose Compose box, autocomplete, attaching files/images label Dec 30, 2024
@chrisbobbe chrisbobbe added this to the M6: Post-launch milestone Dec 30, 2024
chrisbobbe added a commit to chrisbobbe/zulip-flutter that referenced this issue Dec 30, 2024
chrisbobbe added a commit to chrisbobbe/zulip-flutter that referenced this issue Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-compose Compose box, autocomplete, attaching files/images
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant