[ejabberd] unicode trouble with ejabberd_xmlrpc

Steven Lehrburger lehrburger at gmail.com
Fri May 31 23:18:16 MSK 2013

For the sake of anyone with a similar problem in the future that stumbles
across this thread, this can be solved by either patching the module, as
suggested by badlop:


--- src/ejabberd_xmlrpc.erl     (revisión: 1137)
+++ src/ejabberd_xmlrpc.erl     (copia de trabajo)
@@ -401,7 +401,10 @@
format_arg(Arg, string)
   when is_list(Arg) ->
-    Arg.
+    case io_lib:printable_unicode_list(Arg) of
+       true -> binary_to_list(unicode:characters_to_binary(Arg));
+       false -> Arg
+    end.

%% -----------------------------

Or the command handling in ejabberd itself:


There's more detail in the aforementioned GitHub gist.



On Wed, May 29, 2013 at 2:42 AM, Steven Lehrburger <lehrburger at gmail.com>wrote:

> Hi,
> I'm having trouble using unicode characters in roster item nicknames set
> from Python using ejabberd_xmlrpc. Those nicknames work fine if I set them
> from the command line using ejabberdctl add_rosteritem, but if
> use add_rosteritem via xmlrpc, then the command returns as if it
> succeeded... but the roster item is somehow corrupt. ejabberd throws errors
> if I try to view the data using get_roster or the web admin interface, and
> the user with the corrupt roster is also unable to log in.
> I've tested this pretty thoroughly and documented it in the comments here:
> https://gist.github.com/lehrblogger/5668256/ – I'm happy to format a
> version to send to the list, but I'm not sure it would be legible and I
> wanted to keep this short. I'm using the 2.1.x branch of both
> http://github.com/processone/ejabberd and
> http://github.com/processone/ejabberd-contrib with a nearly-default
> ejabberd.cfg file on a fresh VM.
> I know *much* more about character encoding than I did this afternoon, but
> it's still possible I'm making a simple mistake somewhere. But, if not,
> could there be a but in the ejabberd_xmlrpc module? I've looked at the
> source, but haven't had any success figuring out what to patch.
> Thanks!
> Best,
> Steven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20130531/8c3e0e48/attachment.html>

More information about the ejabberd mailing list