[rabbitmq-discuss] Decoding header fields

Tony Garnock-Jones tonygarnockjones+rabbitmq at gmail.com
Thu Aug 2 14:39:43 BST 2012

On 2 August 2012 09:25, Bernhard Mogens Ege <bme at saseco.dk> wrote:

> Hmm looking at WireFormatting.cs, UTF8 is already assumed when converting a
> string to byte[]. Why not assume UTF8
> when receiving the byte[] and return a string instead of a byte[]
> (offending
> method: ReadLongstr)?

Because not all byte[]s are valid UTF-8, AMQP doesn't provide a way of
giving an interpretation for a particular byte vector, and it'd be Bad to
not support transmission of arbitrary binary content over AMQP.

The table writer can cope with Strings by using UTF-8 encoding as a
convenience because C# has given the table writer enough to work with: it
can distinguish byte[]s from Strings. This doesn't hold in the other
direction. The table reader would have to guess.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120802/ec3f6a14/attachment.htm>

More information about the rabbitmq-discuss mailing list