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

Eric Chamberlain eric at ringfree.com
Thu May 19 00:11:11 MSD 2011


Thanks for the help.  

Our acii users can register fine.

We are using django and python.  I should be able to compare your script to our code and find the encoding issue.


On May 18, 2011, at 12:32 PM, Badlop wrote:

> 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:
> jlib:nodeprep([117,115,101,114]).
> "user"
> 
> How i reproduce your error:
> jlib:nodeprep([1575,1604,1582,1576,1585,1575,1606,1610]).
> ** exception error: bad argument
>     in function  port_control/3
>        called as port_control(stringprep_port,2,
>                               [1575,1604,1582,1576,1585,1575,1606,1610])
>     in call from stringprep:control/2
>     in call from jlib:nodeprep/1
> 
> I registered your account using webadmin to obtain the valid representation:
> jlib:nodeprep([216,167,217,132,216,174,216,168,216,177,216,167,217,134,217,138]).
> [216,167,217,132,216,174,216,168,216,177,216,167,217,134,217,138]
> 
> 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:
> --------------------------------------
> !/usr/bin/python
> # vim: set fileencoding=utf-8:
> import xmlrpclib
> server_url = 'http://127.0.0.1:4560';
> 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
> badlop
> badlop2
> الخبراني
> 
> 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) :
> ({socket_state,tls,{tlssock,#Port<0.5353>,#Port<0.5355>},<0.491.0>})
> Accepted authentication for اÙخبراÙÙ by ejabberd_auth_internal
> 
> =INFO REPORT==== 18-May-2011::21:30:56 ===
> I(<0.492.0>:ejabberd_c2s:890) :
> ({socket_state,tls,{tlssock,#Port<0.5353>,#Port<0.5355>},<0.491.0>})
> Opened session for اÙخبراÙÙ@localhost/work
> 
> 
> ---
> Badlop
> ProcessOne
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd



More information about the ejabberd mailing list