Allow the display of Jabber Identifiers (JIDs) with characters prohibited by the Nodeprep profile of stringprep.
WARNING: Consideration of this JEP has been Deferred by the Jabber Software Foundation. Implementation of the protocol described herein is not recommended.
Type: Standards Track
Last Updated: 2003-10-21
JIG: Standards JIG
Approving Body: Jabber Council
Superseded By: None
Short Name: jid#20;escaping
This Jabber Enhancement Proposal is copyright 1999 - 2004 by the Jabber Software Foundation (JSF) and is in full conformance with the JSF's Intellectual Property Rights Policy <http://www.jabber.org/jsf/ipr-policy.php>. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at <http://www.opencontent.org/openpub/>).
The preferred venue for discussion of this document is the Standards-JIG discussion list: <http://mail.jabber.org/mailman/listinfo/standards-jig>.
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core and XMPP IM specifications contributed by the Jabber Software Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocols defined in this JEP have been developed outside the Internet Standards Process and are to be understood as extensions to XMPP rather than as an evolution, development, or modification of XMPP itself.
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
XMPP Core  defines the Nodeprep profile of stringprep (RFC 3454 ), which specifies that the following characters are invalid in the node identifier portion of a JID:
This restriction is a hardship for users who have these characters in their chosen usernames, particularly in the case of ('), which is common in names like O'Hara and D'Artagnan. The restriction is especially onerous if existing email addresses are mapped to JIDs, since some of the foregoing characters are allowed in the username portion of an email address. If (&) had not been in this list, then normal XML escaping conventions could have been used, and, for example, D'Artagnan could have been rended as d'artagnan [sic]. Since there are good reasons for each of the prohibited characters above, another escaping mechanism is desirable.
Although URL encoding (%27) was one possibility, since % is such an often-used character in JIDs (e.g, to replace @ in gateway addresses), this approach was rejected. Future gateways SHOULD use the approach specified by this JEP, instead.
All transformations are exactly as specified. CASE IS SIGNIFICANT. Lowercase was selected since Nodeprep will case fold to lowercase.
The following escaping transformations MAY be used by a conforming entity. Typically, this will only be done by a client that is retrieving information from a user in unescaped form, or by a gateway to some external system that needs to generate a JID.
<message firstname.lastname@example.org/gate' to='d#27;email@example.com' type='chat'> <body>And do you always forget your eyes when you run?</body> </message>
The opposite unescaping transformations MAY be used by a conforming entity. Typically, this is only done by clients that want to display JIDs, and gateways that need to generate identifiers for foreign systems.
<message from='d#27;firstname.lastname@example.org/elder' to='trévilleemail@example.com'> <body>I recommend my son to you.</body> </message>
If a client is going to encode identifiers for use by a gateway, the client needs to know which encoding scheme to use. Clients MUST assume that the gateway does not support this encoding scheme, unless it discovers that the service supports the jid#20;escaping [sic] feature. Namely, if there any errors in the disco exchange, or the jid#20;escaping feature is not discovered, the client SHOULD use the older escaping mechanism (@ transforms to %).
<iq type='get' firstname.lastname@example.org/gate' to='irc.shakespeare.lit' id='info1'> <query xmlns='http://jabber.org/protocol/disco#info'/> </iq>
<iq type='get' email@example.com/gate' from='irc.shakespeare.lit' id='info1'> <query xmlns='http://jabber.org/protocol/disco#info'> ... <feature var='jid#20;escaping'/> </query> </iq>
In order to maintain as much backward compatibility as possible, JIDs that contain partial escape sequences, or escape sequences that are not on the list, MUST be ignored.
foo#bar is not modified by escaping or unescaping transformations
foob#41;r is not modified by escaping or unescaping transformations
As far as the bulk of the system is concerned, an escaped JID has no special processing associated with it. Clients SHOULD render them unescaped. Servers MAY unescape them for communication with external systems (e.g. LDAP), but only AFTER stringprep has been applied. The unescape transformation MUST be NFKC-safe -- i.e., it must conform to Unicode normalization form KC (see Appendix B.3 of RFC 3454). An entity MUST NOT use the unescaped version in any protocol sent to another entity, and MUST NOT use the unescaped version to compare with another JID. Note well: this JEP applies to the node identitier portion of a JID only, and MUST NOT be applied to domain identifiers or resource identifiers.
Entities that enforce JID escaping MUST compare unescaped versions, otherwise a JID conflict could occur.
This JEP requires no interaction with the Internet Assigned Numbers Authority (IANA) .
The jid#20;escaping feature shall be registered with the Jabber Registrar  as a result of this JEP.
1. RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core <http://www.ietf.org/rfc/rfc3920.txt>.
2. RFC 3454: Preparation of Internationalized Strings (stringprep) < http://www.ietf.org/rfc/rfc3454.txt >.
3. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.
4. The Jabber Registrar maintains a list of reserved Jabber protocol namespaces as well as registries of parameters used in the context of protocols approved by the Jabber Software Foundation. For further information, see <http://www.jabber.org/registrar/>.