My assumption was that we are looking at character data on the abstract layer /after/ parsing XML. You shouldn't see entities there (they'd be resolved to their respective characters), nor should you see <![CDATA[]] wrappers.

On 18-12-2019 15:22, Andrew Nenakhov wrote:
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:

& -- &amp;
< -- &lt;
> -- &gt;
" -- &quot;
' - &apos;

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, <[email protected] <mailto:[email protected]>>:

    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: [email protected]
    <mailto:[email protected]>
    _______________________________________________



--
Andrew Nenakhov
CEO, redsolution, OÜ
https://redsolution.com <http://www.redsolution.com>

_______________________________________________
Standards mailing list
Info: https://mail.jabber.org/mailman/listinfo/standards
Unsubscribe: [email protected]
_______________________________________________

--
ralphm

_______________________________________________
Standards mailing list
Info: https://mail.jabber.org/mailman/listinfo/standards
Unsubscribe: [email protected]
_______________________________________________

Reply via email to