powered by Jive Software

How to escape/encode supplementary characters in resource names

Hello everybody,

this is my first post in the forum so please forgive me if I may have posted this in the wrong subforum

Now to my question:

We have built our own custom authentication plugin, that allows users from our systems to login into openfire.

The plugin creates rooms which can only be joined by users if they are in a certain group and forces them to user their default nickname.

This works rather nice except for when the user has emojis or other supplementary characters in their nickname.

In those cases i get a malformed jid error.

Example:

emoji Username
the nickname above contains the name symbol U+1F600 “grinning face”.

I’am using the smack client to connect to our openfire server:

connection.connect();
  connection.login("501-32", "somepassword");
  MultiUserChat room = new MultiUserChat(connection, "6536-32@mydomain.localhost.local");   // server responds malformed JID
  room.join("emoji  Username");   room.sendMessage("cri' cri' cri'");
room.leave();

I double checked with wireshark and it seems that the format of the JID is correct

6536-32@mydomain.localhost.local/emoji\xf0\x9f\x98\x84Username

Do I have to escape supplementary characters? Am I doing something wrong?

Edit:

Unfortunately the forum is “eating” the emoji >.< the 2 spaces are the emoji symbol

In my opinion it should theoretically work, because

Extensible Messaging and Presence Protocol (XMPP): Address Format

says:

This profile uses Unicode 3.2 with the list of unassigned code points in Table A.1, both as defined in Appendix A of [STRINGPREP].

RFC 3454 - Preparation of Internationalized Strings (“stringprep”)

lists U+1F600 as unassigned code point in Appendix A.1 (1D800-1FFFD)

I think it’s a bug in Openfire’s JID logic, which is also very closely related to OF-148.

Openfire uses a third-party library for Stringprep, which is hardly maintained I think. However, OF uses libidn-1.15 and the latest version is 1.29. Maybe it’s worth updating. Maybe you could exchange the library in your local Openfire installatoin and tell us if it works?

Downloading and Installing - GNU Libidn 1.29

CSH schrieb:

In my opinion it should theoretically work, because

Extensible Messaging and Presence Protocol (XMPP): Address Format

says:

This profile uses Unicode 3.2 with the list of unassigned code points in Table A.1, both as defined in Appendix A of [STRINGPREP].

RFC 3454 - Preparation of Internationalized Strings (“stringprep”)

lists U+1F600 as unassigned code point in Appendix A.1 (1D800-1FFFD)

That’s what I thought too

I replaced the libidn library with the newest version, but unfortunately I still get a malformed JID error.

I’m pretty new to the openfire source, so could you please tell me where I could set a breakpoint to examine the JID validation?

Unfortunately, you can’t easily debug it, because the JID class is in another library (Tinder).

If you really have the passion, you could download the Tinder sources (not the released 1.2.2 version, but the unrelease 1.3.0-SNAPSHOT), include them in the project’s classpath and use the sources instead of the Tinder.jar.

Here’s the JID class:

http://svn.igniterealtime.org/svn/repos/tinder/trunk/src/main/java/org/xmpp/pack et/JID.java