пн, 21 окт. 2019 г. в 19:08, Jonathan Lennox <len...@cs.columbia.edu>:

> The right concept here is probably "grapheme clusters", as defined in
> Unicode Standard Annex 29.  ICU has support for this.
>

We have succeded implementing reference processing on three clients and on
the server side. And not one of the developers had problems calculating the
necessary positions. You just handle every emoji as one glyph.

In addition we made a XMPP bot with which you can test different
references: markup, string with escaped text and different media. You can
try it xmpp:dev...@dev.xabber.com

For instance, if you have such text : "😁😂😆 funny comment with some bold
text!" and you want to make it in some part bold, you should count every
symbol in this text and in the end you will get such message to send:


<message type="chat" id="1" from="jul...@capulet.it/phone" to="
ro...@montague.it">
<reference begin="28" end="31" type="markup">
<bold/>
</reference>
<body>😁😂😆 funny comment with some bold text!</body>
</message>

Each of these three emojis is counted as 1 symbol.

The client will render:
[image: Screenshot_2019-10-24 Xabber Web.png]

More complex example with unicode combining characters: "Test ◌⃤ BOLD
italic usual text". We count this graphem as one character. The message
should be like this:

<message from="ro...@montague.it/desktop" to="jul...@capulet.it/phone"
type="chat" id="2">
<reference begin="8" end="12" type="markup">
<bold/>
</reference>
<reference begin="13" end="19" type="markup">
<italic/>
</reference>
<body>Test ◌⃤ BOLD italic usual text</body>
</message>

The client will render:

[image: Screenshot_2019-10-24 Xabber Web(1).png]

In addition we made a XMPP bot with which you can test different
references: markup, string with escaped text and different media content.
You can try it here xmpp:dev...@dev.xabber.com.

-- 
Andrey Gagarin
Developer, Redsolution OÜ
_______________________________________________
Standards mailing list
Info: https://mail.jabber.org/mailman/listinfo/standards
Unsubscribe: standards-unsubscr...@xmpp.org
_______________________________________________

Reply via email to