[ejabberd] Help me diagnose this error when registering over xmlrpc

Badlop badlop at gmail.com
Wed May 18 23:32:47 MSD 2011

2011/5/18 Eric Chamberlain <eric at ringfree.com>:
> Are we not registering non-ascii JID's correctly?
> The JID that failed was a non-ascii JID.  I've included it below:
> JID: الخبراني@rf.com

Right, I think this is a problem about encoding.
First try to register an account username like: abcd
If that works, then you can be sure the problem is about encoding.

Simple valid example:

How i reproduce your error:
** exception error: bad argument
     in function  port_control/3
        called as port_control(stringprep_port,2,
     in call from stringprep:control/2
     in call from jlib:nodeprep/1

I registered your account using webadmin to obtain the valid representation:

So, this is an encoding problem somewhere in the chain of calls:
A) in your xmlrpc client program
B) in xmlrpc erlang library
C) in ejabberd_xmlrpc
D) in ejabberd stringprep

XMPP and ejabberd use UTF-8, but I think Erlang uses latin-1.
Try providing your username with different encodings, until it works.

Now I try a full experiment. I write this file:
# vim: set fileencoding=utf-8:
import xmlrpclib
server_url = '';
server = xmlrpclib.Server(server_url);
params = {}
params["user"] = "ﺎﻠﺨﺑﺭﺎﻨﻳ"
params["host"] = "localhost"
params["password"] = "pas123"
result = server.register(params)
print result

Then execute it:
$ python ./register.py
{'res': 0, 'text': u'User
\u0627\u0644\u062e\u0628\u0631\u0627\u0646\u064a at localhost
successfully registered'}

And check if the account is registered:
$ ejabberdctl registered_users localhost

So, in my case it was registered correctly. I can also see the account
in the WebAdmin.
I can also login. Notice that the log file shows the username as
strange characters:

=INFO REPORT==== 18-May-2011::21:30:56 ===
I(<0.492.0>:ejabberd_c2s:767) :
Accepted authentication for اÙخبراÙÙ by ejabberd_auth_internal

=INFO REPORT==== 18-May-2011::21:30:56 ===
I(<0.492.0>:ejabberd_c2s:890) :
Opened session for اÙخبراÙÙ@localhost/work


More information about the ejabberd mailing list