tindroid icon indicating copy to clipboard operation
tindroid copied to clipboard

Messing up text that has emojis

Open Mj-binary opened this issue 2 years ago • 3 comments

If you paste the text that has emojis from somewhere else into the program, when you send the message, the message will be messed up in the Tindroid. (Everything is fine in the Webapp)

To Reproduce

  1. Copy and send the following text from Bob to Alice 🔴Hello🔴 🟠Hello🟠 🟡Hello🟡 🟢Hello🟢

  2. After sending the text, both Alice and Bob will see the following text 🔴Hello � 🟠Hel o🟠 🟡H llo🟡 🟢Hello🟢

Expected behavior The text is sent and displayed correctly

Tindroid Version 0.22.8 (1665) Device Xiaomi 11t Android 13

Server sandbox.tinode.co

Mj-binary avatar Jul 07 '23 19:07 Mj-binary

The problem here is the length of compound emojis. It's not an easy fix. This is the same reason why this test fails: https://github.com/tinode/tindroid/blob/master/tinodesdk/src/test/java/co/tinode/tinodesdk/model/DraftyTest.java#L83

or-else avatar Jul 07 '23 19:07 or-else

The right approach to this problem would be to use https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/BreakIterator.html

or-else avatar Jul 13 '23 05:07 or-else

Another option is regex \X: https://stackoverflow.com/a/74078861/6692196

or-else avatar Jul 13 '23 06:07 or-else

Fixed in devel. '\X' does not work. The com.ibm.icu.text.BreakIterator works.

or-else avatar May 22 '24 16:05 or-else