[jdev] Escaping JID using XEP-0106

Tomasz Sterna tomek at xiaoka.com
Wed Jun 27 06:17:27 CDT 2007

Dnia 27-06-2007, śro o godzinie 15:03 +0400, Sergei Golovan napisał(a):
> You're right. And the question is: "How to escape it? Can escaping be
> done unambiguously?"

Yes. You have a node, domain and resource which you need to escape
before concatenating them into 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.

Well... You shouldn't show such a monstrosity to a user.
Use the JID parts wisely. Show username, domain eventually 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? 

It's an invalid entry and you should return an error to the user.
You've asked for a JID and the text entered isn't a valid JID.
There is no way of telling which part is what without some external

Tomasz Sterna
Xiaoka Grp.  http://www.xiaoka.com/

More information about the JDev mailing list