You are here

JID Escaping

While I was implementing JID Escaping I came across an inconsistency. It is easy to see that it wont work as a 1-to-1 mapping for general JIDs since the presence of the "@" and "/" characters to be esacped makes it impossible to uniquely decompose a JID into its node+domain+resource constituents.

A recent discussion on the standards@xmpp.org mailing lists clarified a few points. Escaping shall only be applied to JIDs where you can tell the node part a priori. This typically applies to gateway addresses which sometimes allow characters forbidden in XMPP nodes, such as "@". A common case is MSN hotmail addresses, mats@hotmail.com, which need to act as the node part of a JID. Present gateway implementations use a "%" in place of the "@", but there seems to be complications with this.

In any case, JID escaping is now implemented in Coccinella, but I do this on all JIDs, just take the first "@" in a user ID as the true node separator. This is not entirely correct and I need to follow this XEP closely to see how things evolve. It is now possible to register as d'artagnan@home.se and it displays correctly as well. When you add a non-XMPP user I just set the rosters name attribute to the unescaped node part of the JID.

Comments

The IM Gateway plugin for openfire actually doesn't use % in place of @ .. it uses \40 according to the JID escaping XEP. (assuming things haven't changed since I last read it) It's... well a little more cumbersome just because it's easier to type \40 than it is to type % when manually entering a JID. The main client I use doesn't support the translation service where you can type in say, ninja@msn.com and it returns you a properly formatted JID.