[jdev] Escaping JID using XEP-0106

Matthias Wimmer m at tthias.eu
Wed Jun 27 07:44:00 CDT 2007

Hi Sergei!

Sergei Golovan schrieb:
> Then I would like to ask who should escape JIDs and when? I don't
> think that users will read XEP and escape desired characters.

Well escaping will mostly be done by transports. Consider the case of 
the well known msn transport:
MSN has addresses of the form user at domain as well. So the transport when 
it maps this address to a Jabber ID it has to do something with the @ 
sign in this address. Traditional transports did map it to the % 
character. While a transport using XEP-0106 would map it to: 
user\40domain at msn.example.com.

Clients will normally not unescape this address when displaying it. It 
would only be unescaped by the client, if this client would have a 
different interface for MSN messaging (a multi-IM like GUI hiding the 
details that all is routed over the Jabber network for example), where 
it will then just display the user at domain again.

But no Jabber client always tried to display the JIDs generated by the 
msn transport as "user at domain@msn.example.com".

> One possible question is: user's client during registration process.
> And user will be surprised looking at his new brand escaped JID.

Why would a client do escaping during registration? It should just not 
allow the user to enter characters not allowed in the node part of a JID 
when asking it which account it wants to create.

Remember that this XEP is not made to allow new characters to be used in 
user names, but to define a possible way to map addresses, that cannot 
be mapped directly. I gave you one example with XML, another one is in 
URLs when you add parameter values to it (http GET request).


You would also not expect your web browser to display this unescaped in 
the address line. This escaping is just there to be able to transport 
the @ character in value of a request.

The same way XEP-0106 is not about allowing nice new characters and 
displaying them animated in high color and blinking. It is just for the 
case a character has to be transported and cannot be used directly. Any 
use of escaping should be avoided when possible, you only do it if you 
have to.


More information about the JDev mailing list