Allow the display of Jabber Identifiers (JIDs) with characters prohibited by the Nodeprep profile of stringprep.
WARNING: This Standards-Track JEP is Experimental. Publication as a Jabber Enhancement Proposal does not imply approval of this proposal by the Jabber Software Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems should not deploy implementations of this protocol until it advances to a status of Draft.
Type: Standards Track
Last Updated: 2005-03-16
JIG: Standards JIG
Approving Body: Jabber Council
Superseded By: None
Short Name: jid#20;escaping
This Jabber Enhancement Proposal is copyright 1999 - 2005 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.shtml>. 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 (RFC 3920) and XMPP IM (RFC 3921) 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 the ' character, 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 (e.g., the characters & ' / as described in sections 3.2.4 and 3.2.5 of RFC 2822 ). If the & character had not been in this list, then normal XML escaping conventions could have been used, and, for example, D'Artagnan could have been rendered as d'artagnan [sic].
Since there are good reasons for each of the prohibited characters above, another escaping mechanism is desirable. Although it might have been desirable to use URL encoding (%27), that approach was rejected since the % character is such an often-used character in JIDs (e.g, to replace the @ character in gateway addresses). Therefore, a new mechanism is described herein to escape only the foregoing characters in the node identifier portion of Jabber IDs.
This JEP addresses only the following requirements:
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 (e.g., email or LDAP) that needs to generate a JID.
|Unescaped Character||Encoded Character|
<message email@example.com/gate' to='d#27;firstname.lastname@example.org' 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 a client that wants to display JIDs, or by a gateways to some external system (e.g., email or LDAP) that needs to generate identifiers for foreign systems.
|Encoded Character||Decoded Character|
<message from='d#27;email@example.com/elder' to='trévillefirstname.lastname@example.org'> <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. A client 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 'jabber:iq:gateway' protocol (as specified in Gateway Interaction ) if the gateway supports that protocol, or use traditional escaping mechanisms (such as the transformation ofthe @ character to the % character) if support for either jid#20;escaping or jabber:iq:gateway cannot be determined.
<iq type='get' email@example.com/gate' to='irc.shakespeare.lit' id='info1'> <query xmlns='http://jabber.org/protocol/disco#info'/> </iq>
<iq type='get' firstname.lastname@example.org/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.
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 Jabber Registrar  shall include the jid#20;escaping [sic] feature in its registry of service discovery features.
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. RFC 2822: Internet Message Format <http://www.ietf.org/rfc/rfc2822.txt>.
4. JEP-0100: Gateway Interaction <http://www.jabber.org/jeps/jep-0100.html>.
5. 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/>.
6. 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/>.