[jdev] Escaping JID using XEP-0106

Mridul Muralidharan mridul at sun.com
Wed Jun 27 07:18:56 CDT 2007

Sergei Golovan wrote:
> On 6/27/07, Norman Rasmussen <norman at rasmussen.co.za> wrote:
>> On 6/27/07, Sergei Golovan <sgolovan at nes.ru> wrote:
>> > You're right. And the question is: "How to escape it? Can escaping be
>> > done unambiguously?"
>> Yes, but only if you already know the split.
> So, a full unsecaped JID (with resource) can't be split unambiguously.
> Then I'm afraid we should do something with the XEP.

I think you are confused about the intent about the xep here.
The xep allows you to encode unallowed characters such that they can be 
used as part of the jid.
You decode after splitting the jid into its constituents, not before.

So, mridul\40test.com at sun.com is a valid jid, while 
mridul at test.com@sun.com makes no sense - and intent of the xep is not to 
make any sense of it.
You take the node (mridul\40test.com), and then decode it for your 
purpose (mridul at test.com) - not as part of the jid.

>> > The problem is that if I get alredy escaped JID
>> > user\40jabber.org\2fuser at jabber.org/resource then I can
>> unescape it
>> > and show to a user as
>> user at jabber.org/user at jabber.org/resource.
>> >
>> > But what to do if a user enters such a JID into a client entry box and
>> > wants to send a message to it?
>> You have to provider two entry boxes, or require the the user enter a
>> pre-escaped jid, and reject the ambiguous jid.
> There is another problem here. If the user receives message from
> user\40jabber.org\2fuser at jabber.org/resource I can't unescape JID
> because he will not know if the message came from user at jabber.org.
> Using two entry boxes is not good IMHO. It breaks the idea of JID -
> the only user identifier in XMPP world.

Why would you want to unescape it ?
The identifier of the contact is user\40jabber.org\2fuser in xmpp world.
The node by itself conveys no meaning other than when associated with 
the full jid.


More information about the JDev mailing list