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

ASF subversion and git services commented on PROTON-736:
--------------------------------------------------------

Commit 6371e9eba3b82a4927bcfb06919d4b3ea419a8d8 in qpid-proton's branch 
refs/heads/master from [~mcpierce]
[ https://git-wip-us.apache.org/repos/asf?p=qpid-proton.git;h=6371e9e ]

PROTON-736: Created the UTFString and BinaryString classes for Ruby.

This allows users to explictly call out that a string is either UTF-8 or
a binary string.

For the UTFString type, it validates that the content provided is
actually UTF-8 and raises a RuntimeError if it's not.

Results returned from a Message object are wrapped in the appropriate
class.

This solution is Ruby 1.8, 1.9 and 2.0 compatible.


> ruby: unable to send binary data?
> ---------------------------------
>
>                 Key: PROTON-736
>                 URL: https://issues.apache.org/jira/browse/PROTON-736
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: ruby-binding
>    Affects Versions: 0.8
>            Reporter: Dominic Evans
>            Assignee: Darryl L. Pierce
>             Fix For: 0.9
>
>         Attachments: 
> 0001-PROTON-736-Created-the-UTFString-and-BinaryString-cl.patch, 
> 0001-PROTON-736-Ruby-Message-does-not-return-all-content.patch, 
> 0002-PROTON-736-Only-encode-Ruby-strings-as-UTF-8-if-it-s.patch
>
>
> As discussed on irc with [~mcpierce]
> I've not been able to determine how I can correctly send binary data using 
> the ruby gem.
> From proton-c I can do this by (e.g.,)
> {{
> char* msgdata = Buffer::Data(buffer);
> size_t msglen = Buffer::Length(buffer);
> pn_message_set_format(msg->message, PN_DATA);
> pn_message_load_data(msg->message, msgdata, msglen);
> }}
> and I assumed I might be able to do similar from Ruby by (e.g.,)
> {{
> data = File.binread(filename)
> msg.format = Qpid::Proton::MessageFormat::DATA
> msg.content = data
> }}
> But Ruby is reading the data into a string and the SWIG binding is still 
> expecting a byte* array here.
> After our discussions on IRC I also investigated doing:
> {{
> filedata = File.binread(filename)
> data = Qpid::Proton::Data.new
> data.binary = filedata
> msg.body = data
> }}
> but didn't have any luck with this approach either.



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

Reply via email to