<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
We noticed that one of our customers has created some queues whose
names aren't valid UTF-8. From the AMQP spec it looks like
short-strings should be valid UTF-8, and contain only certain
character classes. However, my colleague Frank has tracked down some
code in <a
href="https://github.com/rabbitmq/rabbitmq-server/blob/dc37e725f535861f6d98e7b9c4592978aae57a04/src/rabbit_channel.erl#L560">rabbit_channel:check_name/2</a>,
where there's a comment to the effect that those rules aren't
enforced deliberately. <br>
<br>
However, if we try to request the list of queues via the API, we get
the following backtrace:<br>
<br>
<tt>webmachine error: path="/api/queues"</tt><tt><br>
</tt><tt>{error,{exit,{ucs,{bad_utf8_character_code}},</tt><tt><br>
</tt><tt>
[{xmerl_ucs,from_utf8,1,[{file,"xmerl_ucs.erl"},{line,185}]},</tt><tt><br>
</tt><tt> {mochijson2,json_encode_string,2,[]},</tt><tt><br>
</tt><tt>
{mochijson2,'-json_encode_proplist/2-fun-0-',3,[]},</tt><tt><br>
</tt><tt>
{lists,foldl,3,[{file,"lists.erl"},{line,1248}]},</tt><tt><br>
</tt><tt> {mochijson2,json_encode_proplist,2,[]},</tt><tt><br>
</tt><tt>
{mochijson2,'-json_encode_array/2-fun-0-',3,[]},</tt><tt><br>
</tt><tt>
{lists,foldl,3,[{file,"lists.erl"},{line,1248}]},</tt><tt><br>
</tt><tt> {mochijson2,json_encode_array,2,[]}]}}</tt><br>
<br>
Which seems to indicate that the management console assumes that
entity names are valid UTF-8. We've advised our customer to consider
renaming their queues, but it'd be good to somehow rectify the
difference in assumptions around name encodings. My first thought
might be to percent-encoded non-utf8 data. but there's likely better
ways to handle this.<br>
<br>
The quickest way to reproduce the problem would be to run this ruby
script using Bunny (assuming you have a local rabbit with the
default credentials):<br>
<br>
<tt>require 'bunny'</tt><tt><br>
</tt><tt>bunny = Bunny.new().tap { |b| b.start }</tt><tt><br>
</tt><tt>q = bunny.queue("foo\316null")<br>
<br>
</tt>Once you've done that, if you try to list the queues in the
root virtualhost, you'll find you get the above exception.<br>
<br>
Thanks!<br>
<tt></tt><br>
</body>
</html>