[Standards] Proposed XMPP Extension: Character counting in message bodies

Andrew Nenakhov andrew.nenakhov at redsolution.com
Wed Dec 18 14:22:00 UTC 2019


We're totally onboard with this XEP, and it is, in fact, the way we already
do count characters for references in all versions of Xabber.

However, there is one important case not addressed in this XEP: XML
predefined entities.

Symbols that are to be escaped, as listed in
https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
are:

& -- &
< -- <
> -- >
" -- "
' - '

Counting symbols will result in different outcomes if we count characters
before or after unescaping (from experience, without explicit mention of
this problemour developers have spilt exactly 50/50 on this: 2 developers
did count before unsecaping and 2 - after)

In the end we have settled for counting characters of escaped string, so to
draw *&&&* in a client we count it as string with a length of 15, thus
<bold> reference points to characters 0..14:

<reference xmlns="urn:xmpp:reference:0" begin="0" end="14"
type="markup"><bold /></reference>

вт, 17 дек. 2019 г. в 16:19, <pep at bouah.net>:

> The XMPP Extensions Editor has received a proposal for a new XEP.
>
> Title: Character counting in message bodies
> Abstract:
> This document describes how to correctly count characters in message
> bodies. This is required when referencing a position in the body.
>
> URL: https://xmpp.org/extensions/inbox/charcount.html
>
> The Council will decide in the next two weeks whether to accept this
> proposal as an official XEP.
> _______________________________________________
> Standards mailing list
> Info: https://mail.jabber.org/mailman/listinfo/standards
> Unsubscribe: Standards-unsubscribe at xmpp.org
> _______________________________________________
>


-- 
Andrew Nenakhov
CEO, redsolution, OÜ
https://redsolution.com <http://www.redsolution.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.jabber.org/pipermail/standards/attachments/20191218/898571cb/attachment.html>


More information about the Standards mailing list