You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Rob Godfrey (JIRA)" <ji...@apache.org> on 2015/05/15 17:39:01 UTC

[jira] [Commented] (QPID-6545) malformed cyrillic strings that passed as TextMessage's property

    [ https://issues.apache.org/jira/browse/QPID-6545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14545678#comment-14545678 ] 

Rob Godfrey commented on QPID-6545:
-----------------------------------

Apologies - it looks like the code in the Java client was never updated to reflect the change between AMQP v0.9 where so-called "short strings" were merely defined as up to 255 octets of data, and AMQP v0-9-1 where short strings are (very subtly, and not in the formal type definition section) defined as holding UTF-8 data.  This will affect strings in the properties but not in the message body which carries the text encoding separately.

As a short term workaround the following might work:

Convert your String into a {{byte[]}} using {{value.getBytes("UTF-8")}}
create a {{char[]}} of the same size as the resultant {{byte[]}} and then copy the data with a simple cast on each element:

{code}
for(int i = 0; i < bytes.length; i++)
{
    chars[i] = (char) bytes[i];
}
{code}

then set the property value to the value {{new String(chars)}}.

In the meantime I'll look to get this fixed properly/

> malformed cyrillic strings that passed as TextMessage's property
> ----------------------------------------------------------------
>
>                 Key: QPID-6545
>                 URL: https://issues.apache.org/jira/browse/QPID-6545
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.32
>         Environment: Windows 8 x84 Russian, RabbitMQ 3.1.5
>            Reporter: Nikita Konev
>         Attachments: Runner.java, screenRabbit.png
>
>
> When I attempt pass string that contains cyrillic symbols, it is malformed.
> I see malformed string in Rabbit's web interface and in java code which receives messages from Rabbit.
> Java src in utf8 Runner.java:38 and rabbit's screen attached.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org